register
Registers a suspend handler for the given task ID.
The handler receives a TaskExecutionContext with the task ID, retry count, and any payload attached to the TaskRequest. Unused if you don't need it:
// Simple — context available but ignored
register("sync") { repository.sync() }
// With context
register("sync") { ctx -> println("attempt ${ctx.retryCount}") }Content copied to clipboard
Overwrites any existing handler for the same ID.