Builds a broker over one Queues producer binding.
The Queues producer binding
Id, clock, and timer source; pass IRuntimeServices
Logger thunk and the optional reply-inbox binding
No-op: a producer binding is ready as soon as the Worker has its env, and
there is no connection to open.
Resolves immediately
Closes the reply inbox, rejects every in-flight request, and drops every subscription.
Resolves once the inbox is closed
Dispatches one delivered batch into the registered subscribers and responders.
Every message is acked or retried exactly once:
retry(), because a foreign
producer or a version skew is a configuration problem and acking would
discard the message permanently and silently;ack(), because publishing
to a topic nobody listens on is ordinary pub/sub, and retrying would burn
the queue's retry budget and dead-letter every fire-and-forget message;retry(), leaving the queue's own
max_retries and dead-letter configuration to decide what happens next;ack() after sending the caller a failed reply, because the caller is
waiting and a redelivery would re-run a handler that already ran.The delivered batch
Resolves once every message has been acked or retried
Publishes a message to a topic.
The payload type
Destination topic
The payload, serialized as JSON by the platform
Optionaloptions: PublishOptions
Ordering and de-duplication options (M106); refused as a rejected promise when invalid
Resolves once the platform has accepted the message
Sends a request and awaits its single correlated reply.
The request payload type
The reply payload type
Destination topic a responder is listening on
The request payload
Optionaloptions: RequestOptions
Reply timeout behavior
The reply payload
Registers a responder for a request topic.
The request payload type
The reply payload type
The request topic to respond on
Invoked per request; its result is returned to the caller
Optionaloptions: SubscribeOptions
queue load-balances across members of one group
The active subscription
Subscribes to a topic.
Registration only: delivery happens when the Worker's queue export
dispatches a batch into WorkersBroker.dispatch.
The payload type
Source topic
Invoked per delivered message
Optionaloptions: SubscribeOptions
queue load-balances across members of one group
The active subscription
A message broker backed by Cloudflare Queues.
Consuming requires the application to export the handler
createMessagingHandlerbuilds, and the queue to be declared as a consumer inwrangler.toml:Example
Since
0.2.0