@Test void testOnlySingleSnapshotRemains() { testSubject.storeSnapshot(createEvent(0)); testSubject.storeSnapshot(createEvent(1)); testSubject.storeSnapshot(createEvent(2)); assertEquals(1, mongoTemplate.snapshotCollection().countDocuments()); }
@Override protected void storeSnapshot(DomainEventMessage<?> snapshot, Serializer serializer) { try { storageStrategy.appendSnapshot(template.snapshotCollection(), snapshot, serializer); storageStrategy.deleteSnapshots( template.snapshotCollection(), snapshot.getAggregateIdentifier(), snapshot.getSequenceNumber() ); } catch (Exception e) { handlePersistenceException(e, snapshot); } }
MongoEventStorageEngine extends BatchingEventStorageEngine { @Override protected void storeSnapshot(DomainEventMessage<?> snapshot, Serializer serializer) { try { storageStrategy.appendSnapshot(template.snapshotCollection(), snapshot, serializer); storageStrategy.deleteSnapshots( template.snapshotCollection(), snapshot.getAggregateIdentifier(), snapshot.getSequenceNumber() ); } catch (Exception e) { handlePersistenceException(e, snapshot); } } }
MongoEventStorageEngine extends BatchingEventStorageEngine { @Override protected void storeSnapshot(DomainEventMessage<?> snapshot, Serializer serializer) { try { storageStrategy.appendSnapshot(template.snapshotCollection(), snapshot, serializer); storageStrategy.deleteSnapshots( template.snapshotCollection(), snapshot.getAggregateIdentifier(), snapshot.getSequenceNumber() ); } catch (Exception e) { handlePersistenceException(e, snapshot); } } protected  MongoEventStorageEngine(Builder builder); }
MongoEventStorageEngine extends BatchingEventStorageEngine { @Override protected void storeSnapshot(DomainEventMessage<?> snapshot, Serializer serializer) { try { storageStrategy.appendSnapshot(template.snapshotCollection(), snapshot, serializer); storageStrategy.deleteSnapshots( template.snapshotCollection(), snapshot.getAggregateIdentifier(), snapshot.getSequenceNumber() ); } catch (Exception e) { handlePersistenceException(e, snapshot); } } protected  MongoEventStorageEngine(Builder builder); static Builder builder(); @Deprecated void ensureIndexes(); @Override Optional<Long> lastSequenceNumberFor(String aggregateIdentifier); @Override TrackingToken createTailToken(); @Override TrackingToken createHeadToken(); @Override TrackingToken createTokenAt(Instant dateTime); }
MongoEventStorageEngine extends BatchingEventStorageEngine { @Override protected void storeSnapshot(DomainEventMessage<?> snapshot, Serializer serializer) { try { storageStrategy.appendSnapshot(template.snapshotCollection(), snapshot, serializer); storageStrategy.deleteSnapshots( template.snapshotCollection(), snapshot.getAggregateIdentifier(), snapshot.getSequenceNumber() ); } catch (Exception e) { handlePersistenceException(e, snapshot); } } protected  MongoEventStorageEngine(Builder builder); static Builder builder(); @Deprecated void ensureIndexes(); @Override Optional<Long> lastSequenceNumberFor(String aggregateIdentifier); @Override TrackingToken createTailToken(); @Override TrackingToken createHeadToken(); @Override TrackingToken createTokenAt(Instant dateTime);  }