public final class WorkflowStateMachines
extends java.lang.Object
Constructor and Description |
---|
WorkflowStateMachines(EntityManagerListener callbacks) |
WorkflowStateMachines(EntityManagerListener callbacks,
Functions.Proc1<io.temporal.internal.statemachines.StateMachine> stateMachineSink) |
Modifier and Type | Method and Description |
---|---|
void |
cancelWorkflow() |
void |
completeWorkflow(java.util.Optional<io.temporal.api.common.v1.Payloads> workflowOutput) |
void |
continueAsNewWorkflow(io.temporal.api.command.v1.ContinueAsNewWorkflowExecutionCommandAttributes attributes) |
long |
currentTimeMillis() |
void |
failWorkflow(io.temporal.api.failure.v1.Failure failure) |
long |
getLastStartedEventId() |
void |
getVersion(java.lang.String changeId,
int minSupported,
int maxSupported,
Functions.Proc1<java.lang.Integer> callback) |
void |
handleEvent(io.temporal.api.history.v1.HistoryEvent event,
boolean hasNextEvent)
Handle a single event from the workflow history.
|
void |
handleLocalActivityCompletion(ActivityTaskHandler.Result laCompletion) |
boolean |
isReplaying() |
void |
mutableSideEffect(java.lang.String id,
Functions.Func1<java.util.Optional<io.temporal.api.common.v1.Payloads>,java.util.Optional<io.temporal.api.common.v1.Payloads>> func,
Functions.Proc1<java.util.Optional<io.temporal.api.common.v1.Payloads>> callback) |
java.util.Random |
newRandom() |
Functions.Proc |
newTimer(io.temporal.api.command.v1.StartTimerCommandAttributes attributes,
Functions.Proc1<io.temporal.api.history.v1.HistoryEvent> completionCallback)
Creates a new timer state machine
|
java.util.UUID |
randomUUID() |
void |
requestCancelExternalWorkflowExecution(io.temporal.api.command.v1.RequestCancelExternalWorkflowExecutionCommandAttributes attributes,
Functions.Proc2<java.lang.Void,java.lang.RuntimeException> completionCallback) |
Functions.Proc |
scheduleActivityTask(ExecuteActivityParameters attributes,
Functions.Proc2<java.util.Optional<io.temporal.api.common.v1.Payloads>,io.temporal.api.failure.v1.Failure> callback) |
Functions.Proc |
scheduleLocalActivityTask(ExecuteLocalActivityParameters parameters,
Functions.Proc2<java.util.Optional<io.temporal.api.common.v1.Payloads>,io.temporal.api.failure.v1.Failure> callback) |
void |
setStartedIds(long previousStartedEventId,
long workflowTaskStartedEventId) |
void |
sideEffect(Functions.Func<java.util.Optional<io.temporal.api.common.v1.Payloads>> func,
Functions.Proc1<java.util.Optional<io.temporal.api.common.v1.Payloads>> callback) |
Functions.Proc |
signalExternalWorkflowExecution(io.temporal.api.command.v1.SignalExternalWorkflowExecutionCommandAttributes attributes,
Functions.Proc2<java.lang.Void,io.temporal.api.failure.v1.Failure> completionCallback) |
Functions.Proc |
startChildWorkflow(StartChildWorkflowExecutionParameters parameters,
Functions.Proc1<io.temporal.api.common.v1.WorkflowExecution> startedCallback,
Functions.Proc2<java.util.Optional<io.temporal.api.common.v1.Payloads>,java.lang.Exception> completionCallback)
Creates a new child state machine
|
java.util.List<io.temporal.api.command.v1.Command> |
takeCommands() |
java.util.List<ExecuteLocalActivityParameters> |
takeLocalActivityRequests() |
void |
upsertSearchAttributes(io.temporal.api.common.v1.SearchAttributes attributes) |
public WorkflowStateMachines(EntityManagerListener callbacks)
public WorkflowStateMachines(EntityManagerListener callbacks, Functions.Proc1<io.temporal.internal.statemachines.StateMachine> stateMachineSink)
public void setStartedIds(long previousStartedEventId, long workflowTaskStartedEventId)
public final void handleEvent(io.temporal.api.history.v1.HistoryEvent event, boolean hasNextEvent)
event
- event from the history.hasNextEvent
- false if this is the last event in the history.public java.util.List<io.temporal.api.command.v1.Command> takeCommands()
public long getLastStartedEventId()
public Functions.Proc scheduleActivityTask(ExecuteActivityParameters attributes, Functions.Proc2<java.util.Optional<io.temporal.api.common.v1.Payloads>,io.temporal.api.failure.v1.Failure> callback)
attributes
- attributes used to schedule an activitycallback
- completion callbackpublic Functions.Proc newTimer(io.temporal.api.command.v1.StartTimerCommandAttributes attributes, Functions.Proc1<io.temporal.api.history.v1.HistoryEvent> completionCallback)
attributes
- timer command attributescompletionCallback
- invoked when timer fires or reports cancellation. One of
TimerFiredEvent, TimerCanceledEvent.public Functions.Proc startChildWorkflow(StartChildWorkflowExecutionParameters parameters, Functions.Proc1<io.temporal.api.common.v1.WorkflowExecution> startedCallback, Functions.Proc2<java.util.Optional<io.temporal.api.common.v1.Payloads>,java.lang.Exception> completionCallback)
parameters
- child workflow start command parameters.startedCallback
- callback that is notified about child startcompletionCallback
- invoked when child reports completion or failure.public Functions.Proc signalExternalWorkflowExecution(io.temporal.api.command.v1.SignalExternalWorkflowExecutionCommandAttributes attributes, Functions.Proc2<java.lang.Void,io.temporal.api.failure.v1.Failure> completionCallback)
attributes
- completionCallback
- invoked when signal delivery completes of fails. The following typespublic void requestCancelExternalWorkflowExecution(io.temporal.api.command.v1.RequestCancelExternalWorkflowExecutionCommandAttributes attributes, Functions.Proc2<java.lang.Void,java.lang.RuntimeException> completionCallback)
attributes
- attributes to use to cancel external worklfowcompletionCallback
- one of ExternalWorkflowExecutionCancelRequestedEvent,public void upsertSearchAttributes(io.temporal.api.common.v1.SearchAttributes attributes)
public void completeWorkflow(java.util.Optional<io.temporal.api.common.v1.Payloads> workflowOutput)
public void failWorkflow(io.temporal.api.failure.v1.Failure failure)
public void cancelWorkflow()
public void continueAsNewWorkflow(io.temporal.api.command.v1.ContinueAsNewWorkflowExecutionCommandAttributes attributes)
public boolean isReplaying()
public long currentTimeMillis()
public java.util.UUID randomUUID()
public java.util.Random newRandom()
public void sideEffect(Functions.Func<java.util.Optional<io.temporal.api.common.v1.Payloads>> func, Functions.Proc1<java.util.Optional<io.temporal.api.common.v1.Payloads>> callback)
public void mutableSideEffect(java.lang.String id, Functions.Func1<java.util.Optional<io.temporal.api.common.v1.Payloads>,java.util.Optional<io.temporal.api.common.v1.Payloads>> func, Functions.Proc1<java.util.Optional<io.temporal.api.common.v1.Payloads>> callback)
id
- mutable side effect idfunc
- given the value from the last marker returns value to store. If result is empty
nothing is recorded into the history.callback
- used to report result or failurepublic void getVersion(java.lang.String changeId, int minSupported, int maxSupported, Functions.Proc1<java.lang.Integer> callback)
public java.util.List<ExecuteLocalActivityParameters> takeLocalActivityRequests()
public void handleLocalActivityCompletion(ActivityTaskHandler.Result laCompletion)
public Functions.Proc scheduleLocalActivityTask(ExecuteLocalActivityParameters parameters, Functions.Proc2<java.util.Optional<io.temporal.api.common.v1.Payloads>,io.temporal.api.failure.v1.Failure> callback)