Class SnapshotMessageConsumer

java.lang.Object
de.otto.synapse.compaction.s3.SnapshotMessageConsumer
All Implemented Interfaces:
de.otto.synapse.consumer.MessageConsumer<java.lang.String>, java.util.function.Consumer<de.otto.synapse.message.Message<java.lang.String>>

public class SnapshotMessageConsumer
extends java.lang.Object
implements de.otto.synapse.consumer.MessageConsumer<java.lang.String>
A MessageConsumer that is used to update Snapshots.
  • Constructor Summary

    Constructors 
    Constructor Description
    SnapshotMessageConsumer​(de.otto.synapse.translator.MessageFormat messageFormat, de.otto.synapse.state.StateRepository<java.lang.String> stateRepository)
    Creates a StatefulMessageConsumer.
  • Method Summary

    Modifier and Type Method Description
    void accept​(de.otto.synapse.message.Message<java.lang.String> message)  
    java.util.regex.Pattern keyPattern()
    Returns the pattern of message keys accepted by this consumer.
    java.lang.Class<java.lang.String> payloadType()
    Returns the expected payload type of events consumed by this EventConsumer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Consumer

    andThen
  • Constructor Details

    • SnapshotMessageConsumer

      public SnapshotMessageConsumer​(de.otto.synapse.translator.MessageFormat messageFormat, de.otto.synapse.state.StateRepository<java.lang.String> stateRepository)
      Creates a StatefulMessageConsumer.

      The message's Key.partitionKey() is used as the key for repository entries.

      Parameters:
      messageFormat - the format used to write messages into the snapshot
      stateRepository - the StateRepository that is holding the State
  • Method Details

    • payloadType

      @Nonnull public java.lang.Class<java.lang.String> payloadType()
      Returns the expected payload type of events consumed by this EventConsumer.
      Specified by:
      payloadType in interface de.otto.synapse.consumer.MessageConsumer<java.lang.String>
      Returns:
      payload type
    • keyPattern

      @Nonnull public java.util.regex.Pattern keyPattern()
      Returns the pattern of message keys accepted by this consumer.
      Specified by:
      keyPattern in interface de.otto.synapse.consumer.MessageConsumer<java.lang.String>
      Returns:
      Pattern
    • accept

      public void accept​(de.otto.synapse.message.Message<java.lang.String> message)
      Specified by:
      accept in interface java.util.function.Consumer<de.otto.synapse.message.Message<java.lang.String>>