Skip to main content
Use the Streams mount example with serviceBusReceiver(queue, { kind: "bearer", secret: token }, data) and bind it to streams_service_bus. Here queue is a fixed lowercase entity URL such as https://example.servicebus.windows.net/orders. Use a sealed Microsoft Entra bearer credential with receive and send permissions on that queue. Use matching labels and call streams.serviceBus.initialize({ queue }) with the same URL. This mode covers a non-session queue. Use a fresh mount when replacing it. A Peek-Lock request returns one raw body of at most 16 KiB. The app keys it by the exact broker sequence number, which can exceed JavaScript’s safe integer range. It checks that the settlement URL identifies the selected namespace and queue and matches the broker’s sequence and lock token. The landing transaction retains the File and admits the request that completes the lock. The request can dispatch only after commit. Set the queue lock duration to allow for the commit and send. A lost or expired lock may return the same event with a new token. Invalid and oversized deliveries remain unsettled. The queue owns delivery position and dead lettering, and completion leaves the retained File intact. Call publish({ command, message }) for a UTF-8 message of at most 16 KiB. The caller command becomes the broker’s MessageId. The receiver is sent at most once and the app reports acceptance after the Service Bus send response. Repeating an identical command reads its retained disposition. An ambiguous send stays unknown. See Peek-Lock and Complete a locked message.

Observe a queue over AMQP 1.0

The Streams socket mount also supports non-destructive peek on one unpartitioned, non-session queue. Use azureAmqpReceiver(endpoint, credential, data) from @bijectionhq/app-streams with the namespace DNS address on port 5671. Pass it as broker and initialize with { mode: "amqp10" }. Use the same data label for the receiver and the mount.
Use a Shared Access Signature policy with Listen rights. The receiver presents an entity-scoped SAS claim over the AMQP $cbs node and invokes com.microsoft:peek-message through the queue’s $management node. Each successful page stores one binary Data payload of up to 24 KiB as a sealed File with its sequence. The next request starts after the retained sequence. Empty responses preserve the retained position. Set a new incarnation and review a reset when replacing a queue. Peek does not lock, settle, or remove messages. Messages that other consumers remove or the service expires can leave sequence holes. Earlier observations stay published. This AMQP mode provides queue observation alongside the HTTP peek-lock and complete mode above. Service Bus AMQP peek operation