legacy-workflow-rx2 / com.squareup.workflow.legacy.rx2 / EventSelectBuilder / onWorkerResult

onWorkerResult

inline fun <reified I : Any, reified O : Any> WorkflowPool.onWorkerResult(worker: Worker<I, O>, input: I, name: String = "", noinline handler: (O) -> R): Unit

Selected when the given worker produces its result. If worker wasn't already running, it is started the given input. The caller must ensure that the result is consumed, or else call WorkflowPool.abandonWorker.

This method can be called with the same worker multiple times and it will only be started once, until it finishes. Then, the next time it is called it will restart the worker.

If the nested workflow is abandoned, this case will never be selected.

See Also

WorkflowPool.awaitWorkerResult