Skip to content

[Feature]: Simplify completing (wait for) callbacksΒ #372

@embano1

Description

@embano1

What would you like?

Currently, I have to use the Lambda client SDK to complete callbacks. It would be nice if users could do this through the context (required they have the right IAM permissions).

Possible Implementation

const [promise, callbackId] = await context.createCallback("approval"); // or use waitForCallback
await context.step(...) 
const result = await promise;

await context.completeCallback("complete-approval", callbackId, { approved: true });

Is this a breaking change?

No

Does this require an RFC?

No

Additional Context

Open Questions

  1. Naming convention:

    • SDK-style: completeCallback / failCallback
    • Lambda API-style: sendCallbackSuccess / sendCallbackFailure
  2. Heartbeat inclusion: Should sendCallbackHeartbeat be part of the initial scope, or deferred?

  3. Alternative: Namespaced approach - Should this use a namespace like context.callback.complete() similar to context.promise.all()?

  4. Overloads: Should we support both named and unnamed variants (with/without name parameter) like other context methods?

  5. Should these be durable operations? If called within a durable execution, should the callback completion be recorded in the execution history (for replay safety)?

  6. Naming preference? completeCallback/failCallback vs sendCallbackSuccess/sendCallbackFailure (matching the API names)

  7. Use case scope? Is this primarily for:

  • Completing callbacks within the same durable function (self-completion)
  • Completing callbacks from other durable functions
  • Completing callbacks from non-durable code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions