Class Action


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

  • a pure function.
  • request conversion - you can use Actions to convert incoming data into a different. format before forwarding a call to a different component.
  • as a face or controller to fan out to multiple calls to different components.
  • publish messages to a Topic.
  • subscribe to events from an Event Sourced Entity.
  • subscribe to state changes from a Value Entity.
  • schedule and cancel Timers.

Actions can be triggered in multiple ways. For example, by:

  • a gRPC service call.
  • an HTTP service call.
  • a forwarded call from another component.
  • a scheduled call from a Timer.
  • an incoming message from a Topic.
  • an incoming event from an Event Sourced Entity, from within the same service or from a different service.
  • state changes notification from a Value Entity on the same service.
An Action method should return an Action.Effect that describes what to do next.
  • Constructor Details

    • Action

      public Action()
  • Method Details

    • actionContext

      protected final ActionContext actionContext()
      Additional context and metadata for a message handler.

      It will throw an exception if accessed from constructor.

    • contextForComponents

      protected final ActionContext contextForComponents()

      Same as actionContext, but if specific error message when accessing components.

    • _internalSetActionContext

      public void _internalSetActionContext(Optional<ActionContext> context)
    • effects

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

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