Description
I am thinking about ultimately defining WorkflowHost
as a stream transformation. E.g., using the new preview cold streams library (Kotlin/kotlinx.coroutines#254):
val inputs: Flow<WfInput>
val outputsAndRenderings: Flow<Pair<WfRendering, WfOutput?>> = inputs.flatMapWorkflow(myWorkflow)
It already has a stream of output events, but since we don't have a native kotlin (not to be confused with kotlin native) streams library yet, the host has to have its own lifetime and vend a hot channel. I'd like to turn that into a cold stream that only fires up the workflow universe when subscribed to, and tears it down when that subscription is disposed.
Issue #247 is a proposal for a stream of inputs. With that, WorkflowHost
will have a transformer shape - stream in, stream out. So we can think of a workflow as a fancy way to write reactive operators declaratively.
Tagging this for post-v1.0 because Flow is still preview, so to do this properly we'd currently need to give the runtime direct dependencies on third-party Rx libraries which would be messy.
Activity