Interface EventStore<AID extends AggregateId,​A extends Aggregate<A,​AID>,​E extends Event<AID>>

    • Method Detail

      • ofDynamoDB

        @Nonnull
        static <AID extends AggregateId,​A extends Aggregate<A,​AID>,​E extends Event<AID>> EventStore<AID,​A,​E> ofDynamoDB​(@Nonnull
                                                                                                                                                      software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient,
                                                                                                                                                      @Nonnull
                                                                                                                                                      java.lang.String journalTableName,
                                                                                                                                                      @Nonnull
                                                                                                                                                      java.lang.String snapshotTableName,
                                                                                                                                                      @Nonnull
                                                                                                                                                      java.lang.String journalAidIndexName,
                                                                                                                                                      @Nonnull
                                                                                                                                                      java.lang.String snapshotAidIndexName,
                                                                                                                                                      long shardCount)
        Creates an instance of EventStore for DynamoDB. / DynamoDB用のEventStoreのインスタンスを作成します。
        Type Parameters:
        AID - aggregate id type / 集約IDの型
        A - aggregate type / 集約の型
        E - event type / イベントの型
        Parameters:
        dynamoDbClient - DynamoDbClient
        journalTableName - journal table name / ジャーナルテーブル名
        snapshotTableName - snapshot table name / スナップショットテーブル名
        journalAidIndexName - journal aggregate id index name / ジャーナル集約IDインデックス名
        snapshotAidIndexName - snapshot aggregate id index name / スナップショット集約IDインデックス名
        shardCount - shard count / シャード数
        Returns:
        EventStore
      • getLatestSnapshotById

        @Nonnull
        java.util.Optional<A> getLatestSnapshotById​(@Nonnull
                                                    java.lang.Class<A> clazz,
                                                    @Nonnull
                                                    AID aggregateId)
                                             throws EventStoreReadException,
                                                    DeserializationException
        Gets the latest snapshot by the aggregate id. / 集約IDによる最新のスナップショットを取得します。
        Parameters:
        clazz - class of Aggregate A to be serialized / シリアライズ対象の集約Aのクラス
        aggregateId - id of Aggregate A / 集約AのID
        Returns:
        latest snapshot / 最新のスナップショット
        Throws:
        EventStoreReadException - if an error occurred during reading from the event store / イベントストアからの読み込み中にエラーが発生した場合
        DeserializationException - if an error occurred during serialization / シリアライズ中にエラーが発生した場合
      • getEventsByIdSinceSequenceNumber

        @Nonnull
        java.util.List<E> getEventsByIdSinceSequenceNumber​(@Nonnull
                                                           java.lang.Class<E> clazz,
                                                           @Nonnull
                                                           AID aggregateId,
                                                           long sequenceNumber)
                                                    throws EventStoreReadException,
                                                           DeserializationException
        Gets the events by the aggregate id and since the sequence number. / IDとシーケンス番号以降のイベントを取得します。
        Parameters:
        clazz - class of Event E to be serialized / シリアライズ対象のイベントEのクラス
        aggregateId - id of Aggregate A / 集約AのID
        sequenceNumber - sequence number / シーケンス番号
        Returns:
        events / イベント
        Throws:
        EventStoreReadException - if an error occurred during reading from the event store / イベントストアからの読み込み中にエラーが発生した場合
        DeserializationException - if an error occurred during serialization / シリアライズ中にエラーが発生した場合