chain

suspend fun KmpWorker.chain(chainId: String, policy: ChainPolicy = ChainPolicy.ALLOW_DUPLICATE, block: TaskChainBuilder.() -> Unit)

Builds and enqueues a TaskChain using a fluent DSL.

kmpWorker.chain("onboarding") {
beginWith("fetch-profile")
then("process-data")
then("upload") {
constraints = Constraints(requiresInternet = true)
}
}

Parameters

chainId

Unique identifier for the chain.

policy

How to handle duplicate chain IDs. Defaults to ChainPolicy.ALLOW_DUPLICATE.

block

DSL block to configure chain steps.