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 Link icon

    • Consumer Link icon

      public Consumer()
  • Method Details Link icon

    • messageContext Link icon

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

      It will throw an exception if accessed from constructor.

    • effects Link icon

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

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