Package kalix.javasdk.workflow
Class AbstractWorkflow<S>
Object
kalix.javasdk.workflow.AbstractWorkflow<S>
- Direct Known Subclasses:
ProtoWorkflow
,Workflow
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static interface
An Effect is a description of what Kalix needs to do after the command is handled.static class
static interface
static class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
_internalSetCommandContext
(Optional<CommandContext> context) INTERNAL APIvoid
_internalSetCurrentState
(S state) INTERNAL APIvoid
_internalSetTimerScheduler
(Optional<TimerScheduler> timerScheduler) INTERNAL APIprotected final CommandContext
Additional context and metadata for a command handler.protected final S
Returns the state as currently stored by Kalix.abstract AbstractWorkflow.WorkflowDef<S>
protected final AbstractWorkflow.Effect.Builder<S>
effects()
Returns the initial empty state object.maxRetries
(int maxRetries) Starts defining a recover strategy for the workflow or a specific step.final TimerScheduler
timers()
Returns aTimerScheduler
that can be used to schedule further in time.workflow()
-
Constructor Details
-
AbstractWorkflow
public AbstractWorkflow()
-
-
Method Details
-
emptyState
Returns the initial empty state object. This object will be passed into the command and step handlers, until a new state replaces it.Also known as "zero state" or "neutral state".
The default implementation of this method returns
null
. It can be overridden to return a more sensible initial state. -
commandContext
Additional context and metadata for a command handler.It will throw an exception if accessed from constructor.
- Throws:
IllegalStateException
- if accessed outside a handler method
-
_internalSetCommandContext
INTERNAL API -
_internalSetTimerScheduler
INTERNAL API -
timers
Returns aTimerScheduler
that can be used to schedule further in time. -
_internalSetCurrentState
INTERNAL API -
currentState
Returns the state as currently stored by Kalix.Note that modifying the state directly will not update it in storage. To save the state, one must call {
effects().updateState()
}.This method can only be called when handling a command. Calling it outside a method (eg: in the constructor) will raise a IllegalStateException exception.
- Throws:
IllegalStateException
- if accessed outside a handler method
-
definition
- Returns:
- A workflow definition in a form of steps and transitions between them.
-
effects
-
workflow
-
maxRetries
Starts defining a recover strategy for the workflow or a specific step.- Parameters:
maxRetries
- number of retries before giving up.- Returns:
- MaxRetries strategy.
-