Class Consumer

Object
akka.javasdk.consumer.Consumer

public abstract class Consumer extends Object
Consumers are stateless components that can be used to implement different uses cases, such as:

  • subscribe to events from an Event Sourced Entity.
  • subscribe to state changes from a Key Value Entity.
A Consumer method should return an Consumer.Effect that describes what to do next.

Concrete classes can accept the following types to the constructor:

Concrete class must be annotated with ComponentId and one of the Consume annotations.

  • Constructor Details

    • Consumer

      public Consumer()
  • Method Details

    • messageContext

      protected final MessageContext messageContext()
      Additional context and metadata for a message handler.

      It will throw an exception if accessed from constructor.

    • effects

      public final Consumer.Effect.Builder effects()
    • timers

      public final TimerScheduler timers()
      Returns a TimerScheduler that can be used to schedule further in time.