object ZWorkflow extends ZWorkflowVersionSpecific
- Alphabetic
- By Inheritance
- ZWorkflow
- ZWorkflowVersionSpecific
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val DefaultVersion: Int
- def applyActivityOptions(values: Map[String, ZActivityOptions]): Unit
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<String, ActivityOptions> provided by zio.temporal.worker.ZWorkflowImplementationOptions.activityOptions
These more specific options take precedence over more generic setting setDefaultActivityOptionsAdds 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<String, ActivityOptions> provided by zio.temporal.worker.ZWorkflowImplementationOptions.activityOptions
These more specific options take precedence over more generic setting setDefaultActivityOptionsIf 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- values
a map of activity types to ZActivityOptions
- def applyActivityOptions(values: (String, ZActivityOptions)*): Unit
- See also
- def applyLocalActivityOptions(values: Map[String, ZLocalActivityOptions]): Unit
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 setDefaultLocalActivityOptionsAdds 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 setDefaultLocalActivityOptionsIf 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- values
a map of activity types to ZLocalActivityOptions
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def awaitUntil(timeout: zio.Duration)(cond: => Boolean): Boolean
Suspends workflow execution until either the given predicate holds or timeout elapsed
Suspends workflow execution until either the given predicate holds or timeout elapsed
- timeout
await timeout
- cond
await condition
- returns
unblocks when condition becomes true or timeout elapsed. False if timed out
- See also
Workflow.await
- def awaitUntil(cond: => Boolean): Unit
Suspends workflow execution until the given predicate holds
Suspends workflow execution until the given predicate holds
- cond
await condition
- returns
unblocks when condition becomes true
- See also
Workflow.await
- def awaitWhile(timeout: zio.Duration)(cond: => Boolean): Boolean
Suspends workflow execution while either the given predicate holds or timeout elapsed
Suspends workflow execution while either the given predicate holds or timeout elapsed
- timeout
await timeout
- cond
await condition
- returns
unblocks when condition becomes false or timeout elapsed. False if timed out
- See also
Workflow.await
- def awaitWhile(cond: => Boolean): Unit
Suspends workflow execution while the given predicate holds
Suspends workflow execution while the given predicate holds
- cond
await condition
- returns
unblocks when condition becomes false
- See also
Workflow.await
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def continueAsNew(workflowType: String, options: Option[ZContinueAsNewOptions], args: Any*): Unit
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.
- workflowType
workflow type override for the next run, can be null of no override is needed
- options
option overrides for the next run, can be null if no overrides are needed
- args
arguments of the next run.
- def currentTimeMillis: ZCurrentTimeMillis
Returns current timestamp
Returns current timestamp
Should be used instead of java.lang.System.currentTimeMillis() to guarantee determinism
- returns
current time millis as ZCurrentTimeMillis
- See also
Workflow.currentTimeMillis()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def getLastCompletionResult[R](implicit arg0: TypeIsSpecified[R], arg1: JavaTypeTag[R]): R
GetLastCompletionResult extract last completion result from previous run for this cron workflow.
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.
- R
type of the return data from last run
- returns
result of last run
- See also
io.temporal.client.WorkflowOptions.Builder#setCronSchedule(String)
- def getLogger(clazz: Class[_]): Logger
Get logger to use inside workflow.
Get logger to use inside workflow. Logs in replay mode are omitted unless zio.temporal.worker.ZWorkerFactoryOptions.enableLoggingInReplay is set to 'true'.
- clazz
class name to appear in logging.
- returns
logger to use in workflow logic.
- def getLogger(name: String): Logger
Get logger to use inside workflow.
Get logger to use inside workflow. Logs in replay mode are omitted unless zio.temporal.worker.ZWorkerFactoryOptions.enableLoggingInReplay is set to 'true'.
- name
name to appear in logging.
- returns
logger to use in workflow logic.
- def getMemo[T](key: String)(implicit javaTypeTag: JavaTypeTag[T]): Option[T]
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.
- T
Scala type
- key
memo key
- returns
Some of deserialized Memo or None if the key is not present in the memo
- def getPreviousRunFailure: Option[Exception]
Extract the latest failure from a previous run of this workflow.
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.
- returns
The last Exceptionthat occurred in this workflow, if there has been one.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def info: ZWorkflowInfo
Retrieves workflow info
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- macro def makeLogger: Logger
Get logger to use inside workflow.
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.
- returns
logger to use in workflow logic.
- Definition Classes
- ZWorkflowVersionSpecific
- def metricsScope: com.uber.m3.tally.Scope
Get scope for reporting business metrics in workflow logic.
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.
- def mutableSideEffect[R](id: String, updated: (R, R) => Boolean, f: () => R)(implicit javaTypeTag: JavaTypeTag[R]): R
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.
- R
side effect result type
- 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.
- f
function that produces a value. This function can contain non-deterministic code.
- See also
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def newActivityStub[A](options: ZActivityOptions)(implicit arg0: ClassTag[A], arg1: IsActivity[A]): activity.ZActivityStub.Of[A]
Creates a builder of client stub to activities that implement given interface.
Creates a builder of client stub to activities that implement given interface.
- A
activity interface
- options
activity options
- returns
activity stub builder
- def newCancellationScope[U](thunk: (ZCancellationScope) => U): ZCancellationScope
Wraps a procedure in a CancellationScope.
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.
- thunk
code to wrap in the cancellation scope
- returns
wrapped proc
- See also
Workflow.newCancellationScope
- def newCancellationScope[U](thunk: => U): ZCancellationScope
Wraps a procedure in a CancellationScope.
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.
- thunk
code to wrap in the cancellation scope
- returns
wrapped proc
- See also
Workflow.newCancellationScope
- def newChildWorkflowStub[A](options: ZChildWorkflowOptions)(implicit arg0: ClassTag[A], arg1: IsWorkflow[A]): ZChildWorkflowStub.Of[A]
Creates client stub that can be used to start a child workflow that implements given interface.
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.
- A
interface type implemented by activities
- options
options passed to the child workflow.
- def newContinueAsNewStub[A](options: ZContinueAsNewOptions = ZContinueAsNewOptions.default)(implicit arg0: ClassTag[A], arg1: IsWorkflow[A]): ZWorkflowContinueAsNewStub.Of[A]
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.
- A
workflow type override for the next run, can be null of no override is needed
- options
option overrides for the next run, can be null if no overrides are needed
- def newDetachedCancellationScope[U](thunk: => U): ZCancellationScope
Creates a CancellationScope that is not linked to a parent scope.
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:
- thunk
parameter to wrap in a cancellation scope.
- returns
wrapped parameter.
- See also
Workflow.newDetachedCancellationScope
- def newExternalWorkflowStub[A](workflowExecution: ZWorkflowExecution)(implicit arg0: ClassTag[A], arg1: IsWorkflow[A]): ZExternalWorkflowStub.Of[A]
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
- A
workflow interface
- workflowExecution
execution of the workflow to communicate with.
- returns
external workflow stub
- def newExternalWorkflowStub[A](workflowId: String)(implicit arg0: ClassTag[A], arg1: IsWorkflow[A]): ZExternalWorkflowStub.Of[A]
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
- A
workflow interface
- workflowId
id of the workflow to communicate with.
- returns
external workflow stub
- def newLocalActivityStub[A](options: ZLocalActivityOptions)(implicit arg0: ClassTag[A], arg1: IsActivity[A]): activity.ZActivityStub.Of[A]
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.
- A
activity interface
- options
local activity options
- returns
local activity stub builder
- def newRandom: scala.util.Random
Replay safe random numbers generator.
Replay safe random numbers generator. Seeded differently for each workflow instance.
- def newTimer(delay: zio.Duration): ZAsync[Unit]
Create new timer.
Create new timer. Note that Temporal service time resolution is in seconds. So all durations are rounded up to the nearest second.
- returns
ZAsync
that becomes ready when at least specified number of seconds passes. It is failed with zio.temporal.failure.CanceledFailure if enclosing scope is canceled.
- def newUntypedActivityStub(options: ZActivityOptions): Untyped
Creates a builder of untyped client stub to activities
Creates a builder of untyped client stub to activities
- options
activity options
- returns
untyped activity stub builder
- def newUntypedChildWorkflowStub(workflowType: String, options: ZChildWorkflowOptions): Untyped
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.
- workflowType
name of the workflow type to start.
- options
options passed to the child workflow.
- def newUntypedExternalWorkflowStub(workflowExecution: ZWorkflowExecution): Untyped
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
- workflowExecution
execution of the workflow to communicate with.
- returns
external workflow stub
- def newUntypedExternalWorkflowStub(workflowId: String): Untyped
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
- workflowId
id of the workflow to communicate with.
- returns
external workflow stub
- def newUntypedLocalActivityStub(options: ZLocalActivityOptions): Untyped
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.
- options
local activity options
- returns
local activity stub builder
- def newWorkflowQueue[E](capacity: Int): ZWorkflowQueue[E]
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.
- E
type of queue elements
- capacity
the maximum size of the queue
- returns
new instance of ZWorkflowQueue
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def randomUUID: UUID
Generated random UUID
Generated random UUID
Should be used instead of UUID.randomUUID() to guarantee determinism
- returns
generated UUID
- See also
Workflow.randomUUID()
- def retry[R](options: ZRetryOptions, expiration: Option[zio.Duration] = None)(f: => R): R
Invokes function retrying in case of failures according to retry options.
Invokes function retrying in case of failures according to retry options. Synchronous variant.
- options
retry options that specify retry policy
- expiration
stop retrying after this interval if provided
- f
function to invoke and retry
- returns
result of the function or the last failure.
- def setDefaultActivityOptions(value: ZActivityOptions): Unit
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
ZActivityOptions to be used as a default
- def setDefaultLocalActivityOptions(value: ZLocalActivityOptions): Unit
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
ZLocalActivityOptions to be used as a default
- def sideEffect[R](f: () => R)(implicit javaTypeTag: JavaTypeTag[R]): R
Executes the provided function once, records its result into the workflow history.
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.
- R
side effect result type
- f
function that returns side effect value
- returns
value of the side effect
- See also
- def sleep(duration: zio.Duration): Unit
Suspends workflow execution until the given duration elapsed
Suspends workflow execution until the given duration elapsed
- duration
time to sleep
- returns
unblocks when duration elapsed
- See also
Workflow.sleep
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def typedSearchAttributes: ZSearchAttributes
Get immutable set of search attributes.
Get immutable set of search attributes. To modify search attributes associated with this workflow use upsertSearchAttributes
- returns
immutable set of search attributes.
- def upsertSearchAttributes(attrs: Map[String, ZSearchAttribute]): Unit
Adds or updates workflow search attributes.
Adds or updates workflow search attributes.
- attrs
map of String to ZSearchAttribute value that can be used to search in list APIs
- See also
Workflow.upsertTypedSearchAttributes
- def version(changeId: String, minSupported: Int, maxSupported: Int): Int
Returns current workflow version
Returns current workflow version
- 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.
- minSupported
min version supported for the change
- maxSupported
max version supported for the change
- returns
version
- See also
Workflow.getVersion
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)
- def newActivityStub[A](implicit arg0: ClassTag[A], arg1: IsActivity[A]): Of[A]
Creates a builder of client stub to activities that implement given interface.
Creates a builder of client stub to activities that implement given interface.
- A
activity interface
- returns
activity stub builder
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0) Use newActivityStub accepting ZActivityOptions
- def newChildWorkflowStub[A](implicit arg0: ClassTag[A], arg1: IsWorkflow[A]): Of[A]
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.
- A
workflow interface
- returns
child workflow stub builder
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0) Use newChildWorkflowStub accepting ZChildWorkflowOptions
- def newContinueAsNewStub[A](implicit arg0: ClassTag[A], arg1: IsWorkflow[A]): ZWorkflowContinueAsNewStubBuilder[A]
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.
- A
an interface type implemented by the next run of the workflow
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0) Use newContinueAsNewStub accepting ZContinueAsNewOptions
- def newLocalActivityStub[A](implicit arg0: ClassTag[A], arg1: IsActivity[A]): Of[A]
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.
- A
activity interface
- returns
local activity stub builder
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0) Use newLocalActivityStub accepting ZLocalActivityOptions
- def newUntypedActivityStub: Untyped
Creates a builder of untyped client stub to activities
Creates a builder of untyped client stub to activities
- returns
untyped activity stub builder
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0) Use newUntypedActivityStub accepting ZActivityOptions
- def newUntypedChildWorkflowStub(workflowType: String): Untyped
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.
- returns
child workflow stub builder
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0) Use newUntypedChildWorkflowStub accepting ZChildWorkflowOptions
- def newUntypedLocalActivityStub: Untyped
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.
- returns
local activity stub builder
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0) Use newUntypedLocalActivityStub accepting ZLocalActivityOptions