decodePayload

Decodes the payload of this TaskExecutionContext into a strongly-typed object.

Usage (inside a registered handler):

kmpWorker.registerWithContext("sync-user") {
val data = decodePayload<SyncData>()
repository.sync(data?.userId ?: return@registerWithContext)
}

Return

The decoded object, or null if the payload is absent or deserialization fails.