Class EventStoreAsyncForDynamoDB<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>
- java.lang.Object
-
- com.github.j5ik2o.event.store.adapter.java.internal.EventStoreAsyncForDynamoDB<AID,A,E>
-
- All Implemented Interfaces:
EventStoreAsync<AID,A,E>,EventStoreOptions<EventStoreAsync<AID,A,E>,AID,A,E>
public final class EventStoreAsyncForDynamoDB<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>> extends java.lang.Object implements EventStoreAsync<AID,A,E>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>
EventStoreAsyncForDynamoDB<AID,A,E>create(software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient, java.lang.String journalTableName, java.lang.String snapshotTableName, java.lang.String journalAidIndexName, java.lang.String snapshotAidIndexName, long shardCount)java.util.concurrent.CompletableFuture<java.util.List<E>>getEventsByIdSinceSequenceNumber(java.lang.Class<E> clazz, AID aggregateId, long sequenceNumber)Gets the events by the aggregate id and since the sequence number.java.util.concurrent.CompletableFuture<java.util.Optional<A>>getLatestSnapshotById(java.lang.Class<A> clazz, AID aggregateId)Gets the latest snapshot by the aggregate id.java.util.concurrent.CompletableFuture<java.lang.Void>persistEvent(E event, long version)Persists an event only.java.util.concurrent.CompletableFuture<java.lang.Void>persistEventAndSnapshot(E event, A aggregate)Persists an event and a snapshot.EventStoreAsyncForDynamoDB<AID,A,E>withDeleteTtl(java.time.Duration deleteTtl)EventStoreAsyncForDynamoDB<AID,A,E>withEventSerializer(EventSerializer<AID,E> eventSerializer)EventStoreAsyncForDynamoDB<AID,A,E>withKeepSnapshotCount(long keepSnapshotCount)EventStoreAsyncForDynamoDB<AID,A,E>withKeyResolver(KeyResolver<AID> keyResolver)EventStoreAsyncForDynamoDB<AID,A,E>withSnapshotSerializer(SnapshotSerializer<AID,A> snapshotSerializer)
-
-
-
Method Detail
-
create
public static <AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>> EventStoreAsyncForDynamoDB<AID,A,E> create(@Nonnull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient, @Nonnull java.lang.String journalTableName, @Nonnull java.lang.String snapshotTableName, @Nonnull java.lang.String journalAidIndexName, @Nonnull java.lang.String snapshotAidIndexName, long shardCount)
-
withKeepSnapshotCount
@Nonnull public EventStoreAsyncForDynamoDB<AID,A,E> withKeepSnapshotCount(long keepSnapshotCount)
- Specified by:
withKeepSnapshotCountin interfaceEventStoreOptions<EventStoreAsync<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>,AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>
-
withDeleteTtl
@Nonnull public EventStoreAsyncForDynamoDB<AID,A,E> withDeleteTtl(@Nonnull java.time.Duration deleteTtl)
- Specified by:
withDeleteTtlin interfaceEventStoreOptions<EventStoreAsync<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>,AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>
-
withKeyResolver
@Nonnull public EventStoreAsyncForDynamoDB<AID,A,E> withKeyResolver(@Nonnull KeyResolver<AID> keyResolver)
- Specified by:
withKeyResolverin interfaceEventStoreOptions<EventStoreAsync<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>,AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>
-
withEventSerializer
@Nonnull public EventStoreAsyncForDynamoDB<AID,A,E> withEventSerializer(@Nonnull EventSerializer<AID,E> eventSerializer)
- Specified by:
withEventSerializerin interfaceEventStoreOptions<EventStoreAsync<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>,AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>
-
withSnapshotSerializer
@Nonnull public EventStoreAsyncForDynamoDB<AID,A,E> withSnapshotSerializer(@Nonnull SnapshotSerializer<AID,A> snapshotSerializer)
- Specified by:
withSnapshotSerializerin interfaceEventStoreOptions<EventStoreAsync<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>,AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>
-
getLatestSnapshotById
@Nonnull public java.util.concurrent.CompletableFuture<java.util.Optional<A>> getLatestSnapshotById(@Nonnull java.lang.Class<A> clazz, @Nonnull AID aggregateId)
Description copied from interface:EventStoreAsyncGets the latest snapshot by the aggregate id. / 集約IDによる最新のスナップショットを取得します。- Specified by:
getLatestSnapshotByIdin interfaceEventStoreAsync<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>- Parameters:
clazz- class ofAggregateA to be deserialized / デシリアライズ対象の集約AのクラスaggregateId- id ofAggregateA / 集約AのID- Returns:
- latest snapshot wrapped by
CompletableFuture/CompletableFutureでラップされた最新のスナップショット
-
getEventsByIdSinceSequenceNumber
@Nonnull public java.util.concurrent.CompletableFuture<java.util.List<E>> getEventsByIdSinceSequenceNumber(@Nonnull java.lang.Class<E> clazz, @Nonnull AID aggregateId, long sequenceNumber)
Description copied from interface:EventStoreAsyncGets the events by the aggregate id and since the sequence number. / 集約IDとシーケンス番号以降のイベントを取得します。- Specified by:
getEventsByIdSinceSequenceNumberin interfaceEventStoreAsync<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>- Parameters:
clazz- class ofEventE to be deserialized / デシリアライズ対象のイベントEのクラスaggregateId-Aggregateid / 集約のIDsequenceNumber- sequence number / シーケンス番号- Returns:
- list of
Eventwrapped byCompletableFuture/CompletableFutureでラップされたEventのリスト
-
persistEvent
@Nonnull public java.util.concurrent.CompletableFuture<java.lang.Void> persistEvent(@Nonnull E event, long version)Description copied from interface:EventStoreAsyncPersists an event only. / イベントのみを永続化します。- Specified by:
persistEventin interfaceEventStoreAsync<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>- Parameters:
event-Event/ イベントversion- version / バージョン- Returns:
CompletableFuturewithout result / 結果を持たないCompletableFuture
-
persistEventAndSnapshot
@Nonnull public java.util.concurrent.CompletableFuture<java.lang.Void> persistEventAndSnapshot(@Nonnull E event, @Nonnull A aggregate)Description copied from interface:EventStoreAsyncPersists an event and a snapshot. / イベントとスナップショットを永続化します。- Specified by:
persistEventAndSnapshotin interfaceEventStoreAsync<AID extends AggregateId,A extends Aggregate<A,AID>,E extends Event<AID>>- Parameters:
event-Event/ イベントaggregate-Aggregate/ 集約- Returns:
CompletableFuturewithout result / 結果を持たないCompletableFuture
-
-