Class StateRepositorySnapshotProvider<E>

java.lang.Object
de.otto.synapse.subscription.StateRepositorySnapshotProvider<E>
Type Parameters:
E -
All Implemented Interfaces:
SnapshotProvider

public class StateRepositorySnapshotProvider<E> extends Object implements SnapshotProvider
A SnapshotProvider that is relying on a StateRepository to generate the snapshot messages for a given entity-id.

Using an EntityToMessageListTransformer, the entities stored in the StateRepository can be transformed into a sequence of messages. This is especially required, if the representation of the entity does not match the payload of the snapshot messages.

  • Constructor Details

  • Method Details

    • channelName

      public String channelName()
      Description copied from interface: SnapshotProvider
      The name of the subscribable messaging channel.
      Specified by:
      channelName in interface SnapshotProvider
      Returns:
      channel name
    • snapshot

      public Stream<? extends Message<?>> snapshot(String entityId)
      Description copied from interface: SnapshotProvider
      Returns a stream containing all Messages required to get the most current snapshot for the entity that is identified by the given entityId
      Specified by:
      snapshot in interface SnapshotProvider
      Parameters:
      entityId - the identifier used to select a single entity.
      Returns:
      Stream of messages