ZWorkflow
Attributes
- Graph
-
- Supertypes
- Self type
-
ZWorkflow.type
Members list
Value members
Concrete methods
Attributes
- See also
Adds activity options per activity type ('''activity method name''') that will be used for an activity stub that has no ZActivityOptions specified.
This method refines an original set of @code Map provided by zio.temporal.worker.ZWorkflowImplementationOptions.activityOptions
These more specific options take precedence over more generic setting setDefaultActivityOptions
Adds activity options per activity type ('''activity method name''') that will be used for an activity stub that has no ZActivityOptions specified.
This method refines an original set of @code Map provided by zio.temporal.worker.ZWorkflowImplementationOptions.activityOptions
These more specific options take precedence over more generic setting setDefaultActivityOptions
If an activity type already has a ZActivityOptions set by an earlier call to this method or from zio.temporal.worker.ZWorkflowImplementationOptions.defaultActivityOptions, new ZActivityOptions from values will be merged into the old ones by Java SDK's ActivityOptions.Builder.mergeActivityOptions
Value parameters
- values
-
a map of activity types to ZActivityOptions
Attributes
Adds local activity options per activity type ('''activity method name''') that will be used for a local activity stub that has no ZLocalActivityOptions specified.
This method refines an original set of options provided by zio.temporal.worker.ZWorkflowImplementationOptions.defaultLocalActivityOptions
These more specific options take precedence over more generic setting setDefaultLocalActivityOptions
Adds local activity options per activity type ('''activity method name''') that will be used for a local activity stub that has no ZLocalActivityOptions specified.
This method refines an original set of options provided by zio.temporal.worker.ZWorkflowImplementationOptions.defaultLocalActivityOptions
These more specific options take precedence over more generic setting setDefaultLocalActivityOptions
If an activity type already has a ZLocalActivityOptions set by an earlier call to this method or from zio.temporal.worker.ZWorkflowImplementationOptions.defaultLocalActivityOptions, new ZLocalActivityOptions from values will be merged into the old ones using LocalActivityOptions.Builder.mergeActivityOptions
Value parameters
- values
-
a map of activity types to ZLocalActivityOptions
Attributes
Suspends workflow execution until the given predicate holds
Suspends workflow execution until the given predicate holds
Value parameters
- cond
-
await condition
Attributes
- Returns
-
unblocks when condition becomes true
- See also
-
Workflow.await
Suspends workflow execution until either the given predicate holds or timeout elapsed
Suspends workflow execution until either the given predicate holds or timeout elapsed
Value parameters
- cond
-
await condition
- timeout
-
await timeout
Attributes
- Returns
-
unblocks when condition becomes true or timeout elapsed. '''False''' if timed out
- See also
-
Workflow.await
Suspends workflow execution while the given predicate holds
Suspends workflow execution while the given predicate holds
Value parameters
- cond
-
await condition
Attributes
- Returns
-
unblocks when condition becomes false
- See also
-
Workflow.await
Suspends workflow execution while either the given predicate holds or timeout elapsed
Suspends workflow execution while either the given predicate holds or timeout elapsed
Value parameters
- cond
-
await condition
- timeout
-
await timeout
Attributes
- Returns
-
unblocks when condition becomes false or timeout elapsed. '''False''' if timed out
- See also
-
Workflow.await
Continues the current workflow execution as a new run possibly overriding the workflow type and options.
Continues the current workflow execution as a new run possibly overriding the workflow type and options.
Value parameters
- args
-
arguments of the next run.
- options
-
option overrides for the next run, can be null if no overrides are needed
- workflowType
-
workflow type override for the next run, can be null of no override is needed
Attributes
Returns current timestamp
Returns current timestamp
Should be used instead of java.lang.System.currentTimeMillis() to guarantee determinism
Attributes
- Returns
-
current time millis as ZCurrentTimeMillis
- See also
-
Workflow.currentTimeMillis()
GetLastCompletionResult extract last completion result from previous run for this cron workflow. This is used in combination with cron schedule. A workflow can be started with an optional cron schedule. If a cron workflow wants to pass some data to next schedule, it can return any data and that data will become available when next run starts.
GetLastCompletionResult extract last completion result from previous run for this cron workflow. This is used in combination with cron schedule. A workflow can be started with an optional cron schedule. If a cron workflow wants to pass some data to next schedule, it can return any data and that data will become available when next run starts.
Type parameters
- R
-
type of the return data from last run
Attributes
- Returns
-
result of last run
- See also
-
io.temporal.client.WorkflowOptions.Builder#setCronSchedule(String)
Get logger to use inside workflow. Logs in replay mode are omitted unless zio.temporal.worker.ZWorkerFactoryOptions.enableLoggingInReplay is set to 'true'.
Get logger to use inside workflow. Logs in replay mode are omitted unless zio.temporal.worker.ZWorkerFactoryOptions.enableLoggingInReplay is set to 'true'.
Value parameters
- name
-
name to appear in logging.
Attributes
- Returns
-
logger to use in workflow logic.
Get logger to use inside workflow. Logs in replay mode are omitted unless zio.temporal.worker.ZWorkerFactoryOptions.enableLoggingInReplay is set to 'true'.
Get logger to use inside workflow. Logs in replay mode are omitted unless zio.temporal.worker.ZWorkerFactoryOptions.enableLoggingInReplay is set to 'true'.
Value parameters
- clazz
-
class name to appear in logging.
Attributes
- Returns
-
logger to use in workflow logic.
Extract Memo associated with the given key and deserialized into an object of generic type.
Extract Memo associated with the given key and deserialized into an object of generic type.
Type parameters
- T
-
Scala type
Value parameters
- key
-
memo key
Attributes
- Returns
-
Some of deserialized Memo or None if the key is not present in the memo
Extract the latest failure from a previous run of this workflow. If any previous run of this workflow has failed, this function returns that failure. If no previous runs have failed, an empty optional is returned. The run you are calling this from may have been created as a retry of the previous failed run or as a next cron invocation for cron workflows.
Extract the latest failure from a previous run of this workflow. If any previous run of this workflow has failed, this function returns that failure. If no previous runs have failed, an empty optional is returned. The run you are calling this from may have been created as a retry of the previous failed run or as a next cron invocation for cron workflows.
Attributes
- Returns
-
The last Exceptionthat occurred in this workflow, if there has been one.
Retrieves workflow info
Get scope for reporting business metrics in workflow logic. This should be used instead of creating new metrics scopes as it is able to dedupe metrics during replay.
Get scope for reporting business metrics in workflow logic. This should be used instead of creating new metrics scopes as it is able to dedupe metrics during replay.
The original metrics scope is set through ZWorkflowServiceStubsOptions.withMetricsScope when a worker starts up.
Attributes
mutableSideEffect is similar to sideEffect in allowing calls of non-deterministic functions from workflow code.
mutableSideEffect is similar to sideEffect in allowing calls of non-deterministic functions from workflow code.
The difference between mutableSideEffect and sideEffect is that every new sideEffect call in non-replay mode results in a new marker event recorded into the history. However, mutableSideEffect only records a new marker if a value has changed. During the replay, mutableSideEffect will not execute the function again, but it will return the exact same value as it was returning during the non-replay run.
One good use case of mutableSideEffect is to access a dynamically changing config without breaking determinism. Even if called very frequently the config value is recorded only when it changes not causing any performance degradation due to a large history size.
Caution: do not use mutableSideEffect function to modify any workflow state. Only use the mutableSideEffect's return value.
If function throws any exception it is not delivered to the workflow code. It is wrapped in Error causing failure of the current workflow task.
Type parameters
- R
-
side effect result type
Value parameters
- f
-
function that produces a value. This function can contain non-deterministic code.
- id
-
unique identifier of this side effect
- updated
-
used to decide if a new value should be recorded. A func result is recorded only if call to updated with stored and a new value as arguments returns true. It is not called for the first value.
Attributes
- See also
Creates a builder of client stub to activities that implement given interface.
Creates a builder of client stub to activities that implement given interface.
Type parameters
- A
-
activity interface
Value parameters
- options
-
activity options
Attributes
- Returns
-
activity stub builder
Wraps a procedure in a CancellationScope. The procedure receives the wrapping CancellationScope as a parameter. Useful when cancellation is requested from within the wrapped code. The following example cancels the sibling activity on any failure.
Wraps a procedure in a CancellationScope. The procedure receives the wrapping CancellationScope as a parameter. Useful when cancellation is requested from within the wrapped code. The following example cancels the sibling activity on any failure.
Value parameters
- thunk
-
code to wrap in the cancellation scope
Attributes
- Returns
-
wrapped proc
- See also
-
Workflow.newCancellationScope
Wraps a procedure in a CancellationScope. The procedure receives the wrapping CancellationScope as a parameter. Useful when cancellation is requested from within the wrapped code. The following example cancels the sibling activity on any failure.
Wraps a procedure in a CancellationScope. The procedure receives the wrapping CancellationScope as a parameter. Useful when cancellation is requested from within the wrapped code. The following example cancels the sibling activity on any failure.
Value parameters
- thunk
-
code to wrap in the cancellation scope
Attributes
- Returns
-
wrapped proc
- See also
-
Workflow.newCancellationScope
Creates client stub that can be used to start a child workflow that implements given interface. Use newExternalWorkflowStub to get a stub to signal a workflow without starting it.
Creates client stub that can be used to start a child workflow that implements given interface. Use newExternalWorkflowStub to get a stub to signal a workflow without starting it.
Type parameters
- A
-
interface type implemented by activities
Value parameters
- options
-
options passed to the child workflow.
Attributes
Continues the current workflow execution as a new run possibly overriding the workflow type and options.
Continues the current workflow execution as a new run possibly overriding the workflow type and options.
Type parameters
- A
-
workflow type override for the next run, can be null of no override is needed
Value parameters
- options
-
option overrides for the next run, can be null if no overrides are needed
Attributes
Creates a CancellationScope that is not linked to a parent scope. ZCancellationScope.run() must be called to execute the code the scope wraps. The detached scope is needed to execute cleanup code after a workflow is canceled which cancels the root scope that wraps the @WorkflowMethod invocation. Here is an example usage:
Creates a CancellationScope that is not linked to a parent scope. ZCancellationScope.run() must be called to execute the code the scope wraps. The detached scope is needed to execute cleanup code after a workflow is canceled which cancels the root scope that wraps the @WorkflowMethod invocation. Here is an example usage:
Value parameters
- thunk
-
parameter to wrap in a cancellation scope.
Attributes
- Returns
-
wrapped parameter.
- See also
-
Workflow.newDetachedCancellationScope
Creates client stub that can be used to signal or cancel an existing workflow
Creates client stub that can be used to signal or cancel an existing workflow
Type parameters
- A
-
workflow interface
Value parameters
- workflowId
-
id of the workflow to communicate with.
Attributes
- Returns
-
external workflow stub
Creates client stub that can be used to signal or cancel an existing workflow
Creates client stub that can be used to signal or cancel an existing workflow
Type parameters
- A
-
workflow interface
Value parameters
- workflowExecution
-
execution of the workflow to communicate with.
Attributes
- Returns
-
external workflow stub
Creates a builder of client stub to local activities that implement given interface.
Creates a builder of client stub to local activities that implement given interface.
Type parameters
- A
-
activity interface
Value parameters
- options
-
local activity options
Attributes
- Returns
-
local activity stub builder
Replay safe random numbers generator. Seeded differently for each workflow instance.
Replay safe random numbers generator. Seeded differently for each workflow instance.
Attributes
Create new timer. Note that Temporal service time resolution is in seconds. So all durations are rounded up to the nearest second.
Create new timer. Note that Temporal service time resolution is in seconds. So all durations are rounded up to the nearest second.
Attributes
- Returns
-
ZAsyncthat becomes ready when at least specified number of seconds passes. It is failed with zio.temporal.failure.CanceledFailure if enclosing scope is canceled.
Creates a builder of untyped client stub to activities
Creates a builder of untyped client stub to activities
Value parameters
- options
-
activity options
Attributes
- Returns
-
untyped activity stub builder
Creates untyped client stub that can be used to start and signal a child workflow.
Creates untyped client stub that can be used to start and signal a child workflow.
Value parameters
- options
-
options passed to the child workflow.
- workflowType
-
name of the workflow type to start.
Attributes
Creates untyped client stub that can be used to signal or cancel an existing workflow
Creates untyped client stub that can be used to signal or cancel an existing workflow
Value parameters
- workflowId
-
id of the workflow to communicate with.
Attributes
- Returns
-
external workflow stub
Creates untyped client stub that can be used to signal or cancel an existing workflow
Creates untyped client stub that can be used to signal or cancel an existing workflow
Value parameters
- workflowExecution
-
execution of the workflow to communicate with.
Attributes
- Returns
-
external workflow stub
Creates a builder of untyped client stub to local activities that implement given interface.
Creates a builder of untyped client stub to local activities that implement given interface.
Value parameters
- options
-
local activity options
Attributes
- Returns
-
local activity stub builder
Create a new instance of a ZWorkflowQueue implementation that is adapted to be used from a workflow code.
Create a new instance of a ZWorkflowQueue implementation that is adapted to be used from a workflow code.
Type parameters
- E
-
type of queue elements
Value parameters
- capacity
-
the maximum size of the queue
Attributes
- Returns
-
new instance of ZWorkflowQueue
Generated random UUID
Generated random UUID
Should be used instead of UUID.randomUUID() to guarantee determinism
Attributes
- Returns
-
generated UUID
- See also
-
Workflow.randomUUID()
Invokes function retrying in case of failures according to retry options. Synchronous variant.
Invokes function retrying in case of failures according to retry options. Synchronous variant.
Value parameters
- expiration
-
stop retrying after this interval if provided
- f
-
function to invoke and retry
- options
-
retry options that specify retry policy
Attributes
- Returns
-
result of the function or the last failure.
Sets the default activity options that will be used for activity stubs that have no ZActivityOptions specified.
This overrides a value provided by zio.temporal.worker.ZWorkflowImplementationOptions.defaultActivityOptions.
A more specific per-activity-type option specified in zio.temporal.worker.ZWorkflowImplementationOptions.activityOptions or applyActivityOptions takes precedence over this setting.
Sets the default activity options that will be used for activity stubs that have no ZActivityOptions specified.
This overrides a value provided by zio.temporal.worker.ZWorkflowImplementationOptions.defaultActivityOptions.
A more specific per-activity-type option specified in zio.temporal.worker.ZWorkflowImplementationOptions.activityOptions or applyActivityOptions takes precedence over this setting.
Value parameters
- value
-
ZActivityOptions to be used as a default
Attributes
Sets the default local activity options that will be used for activity stubs that have no ZLocalActivityOptions specified.
This overrides a value provided by zio.temporal.worker.ZWorkflowImplementationOptions.defaultLocalActivityOptions.
A more specific per-activity-type option specified in zio.temporal.worker.ZWorkflowImplementationOptions.localActivityOptions or applyLocalActivityOptions takes precedence over this setting.
Sets the default local activity options that will be used for activity stubs that have no ZLocalActivityOptions specified.
This overrides a value provided by zio.temporal.worker.ZWorkflowImplementationOptions.defaultLocalActivityOptions.
A more specific per-activity-type option specified in zio.temporal.worker.ZWorkflowImplementationOptions.localActivityOptions or applyLocalActivityOptions takes precedence over this setting.
Value parameters
- value
-
ZLocalActivityOptions to be used as a default
Attributes
Executes the provided function once, records its result into the workflow history. The recorded result on history will be returned without executing the provided function during replay. This guarantees the deterministic requirement for workflow as the exact same result will be returned in replay. Common use case is to run some short non-deterministic code in workflow, like getting random number. The only way to fail SideEffect is to panic which causes workflow task failure. The workflow task after timeout is rescheduled and re-executed giving SideEffect another chance to succeed.
Executes the provided function once, records its result into the workflow history. The recorded result on history will be returned without executing the provided function during replay. This guarantees the deterministic requirement for workflow as the exact same result will be returned in replay. Common use case is to run some short non-deterministic code in workflow, like getting random number. The only way to fail SideEffect is to panic which causes workflow task failure. The workflow task after timeout is rescheduled and re-executed giving SideEffect another chance to succeed.
If function throws any exception it is not delivered to the workflow code. It is wrapped in Error causing failure of the current workflow task.
Type parameters
- R
-
side effect result type
Value parameters
- f
-
function that returns side effect value
Attributes
- Returns
-
value of the side effect
- See also
Suspends workflow execution until the given duration elapsed
Suspends workflow execution until the given duration elapsed
Value parameters
- duration
-
time to sleep
Attributes
- Returns
-
unblocks when duration elapsed
- See also
-
Workflow.sleep
Get immutable set of search attributes. To modify search attributes associated with this workflow use upsertSearchAttributes
Get immutable set of search attributes. To modify search attributes associated with this workflow use upsertSearchAttributes
Attributes
- Returns
-
immutable set of search attributes.
Adds or updates workflow search attributes.
Adds or updates workflow search attributes.
Value parameters
- attrs
-
map of String to ZSearchAttribute value that can be used to search in list APIs
Attributes
- See also
-
Workflow.upsertTypedSearchAttributes
Returns current workflow version
Returns current workflow version
Value parameters
- changeId
-
identifier of a particular change. All calls to getVersion that share a changeId are guaranteed to return the same version number. Use this to perform multiple coordinated changes that should be enabled together.
- maxSupported
-
max version supported for the change
- minSupported
-
min version supported for the change
Attributes
- Returns
-
version
- See also
-
Workflow.getVersion
Deprecated methods
Creates a builder of client stub to activities that implement given interface.
Creates a builder of client stub to activities that implement given interface.
Type parameters
- A
-
activity interface
Attributes
- Returns
-
activity stub builder
- Deprecated
-
[Since version 0.6.0]Use newActivityStub accepting ZActivityOptions
Creates a builder of client stub that can be used to start a child workflow that implements given interface.
Creates a builder of client stub that can be used to start a child workflow that implements given interface.
Type parameters
- A
-
workflow interface
Attributes
- Returns
-
child workflow stub builder
- Deprecated
-
[Since version 0.6.0]Use newChildWorkflowStub accepting ZChildWorkflowOptions
Creates a client stub that can be used to continue this workflow as a new run.
Creates a client stub that can be used to continue this workflow as a new run.
Type parameters
- A
-
an interface type implemented by the next run of the workflow
Attributes
- Deprecated
-
[Since version 0.6.0]Use newContinueAsNewStub accepting ZContinueAsNewOptions
Creates a builder of client stub to local activities that implement given interface.
Creates a builder of client stub to local activities that implement given interface.
Type parameters
- A
-
activity interface
Attributes
- Returns
-
local activity stub builder
- Deprecated
-
[Since version 0.6.0]Use newLocalActivityStub accepting ZLocalActivityOptions
Creates a builder of untyped client stub to activities
Creates a builder of untyped client stub to activities
Attributes
- Returns
-
untyped activity stub builder
- Deprecated
-
[Since version 0.6.0]Use newUntypedActivityStub accepting ZActivityOptions
Creates a builder of untyped client stub that can be used to start a child workflow that implements given interface.
Creates a builder of untyped client stub that can be used to start a child workflow that implements given interface.
Attributes
- Returns
-
child workflow stub builder
- Deprecated
-
[Since version 0.6.0]Use newUntypedChildWorkflowStub accepting ZChildWorkflowOptions
Creates a builder of untyped client stub to local activities that implement given interface.
Creates a builder of untyped client stub to local activities that implement given interface.
Attributes
- Returns
-
local activity stub builder
- Deprecated
-
[Since version 0.6.0]Use newUntypedLocalActivityStub accepting ZLocalActivityOptions
Inherited methods
Get logger to use inside workflow. Logs in replay mode are omitted unless zio.temporal.worker.ZWorkerFactoryOptions.enableLoggingInReplay is set to 'true'.
Get logger to use inside workflow. Logs in replay mode are omitted unless zio.temporal.worker.ZWorkerFactoryOptions.enableLoggingInReplay is set to 'true'.
The logger name will correspond to the enclosing class/trait name.
Attributes
- Returns
-
logger to use in workflow logic.
- Inherited from:
- ZWorkflowVersionSpecific