Durable Functions

Publish a message from inside a workflow

Changed on

Publishes a named message from a running workflow. The Volcano SDK calls this from ctx.publish; applications do not call it directly.

The message is stored, listed with the execution's messages, and delivered live to clients subscribed to the execution. Live delivery counts against the project's Realtime messages.

The SDK sends an Idempotency-Key that a rerun of the publishing step repeats, so a step that runs again returns the first message with 200 and stores nothing new. That message is delivered live again, and counts again, because the first run may have stopped before subscribers got it. The SDKs deliver it to a subscriber once.

post/durable-messages/publish

Request

  • Base URL
    https://api.volcano.dev
  • Auth
    none required

Headers

X-Volcano-Durable-Session, string required

The session token the workflow received when its session opened.

Idempotency-Key, string

Makes a send safe to retry. A repeat with a key the same sender has used on the execution returns the first message and sends nothing. Keys of different senders never collide. Up to 255 printable ASCII characters.

Request body

PublishDurableMessageRequest required
name, string required

The name a workflow waits on or publishes under: up to 237 printable ASCII characters.

data, unknown

Response

A message with this Idempotency-Key was already published; it is returned

DurableMessage required

A message sent to, or published by, a durable execution.

id, string uuid required
execution_id, string uuid required
direction, 'in' | 'out' required

in is a message sent to the execution. out is one the execution published.

seq, integer required

Orders the execution's messages in both directions. It increases with every message but can skip numbers. Pass the last one you read as after to read what came next.

name, string required
data, unknown required
sender, DurableMessageSender required

Who sent the message.

status, 'queued' | 'delivering' | 'delivered' | 'dropped' | 'published' required

An in message is queued until a wait for its name takes it, delivering while it is handed over, and delivered once the execution has it. It is dropped if the execution ended before any wait took it. Every out message is published.

delivered_at, string date-time nullable required

When the execution received the message. Null until then, and for out messages.

sent_at, string date-time required

Changes