> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure Service Bus

> Peek-lock and complete Azure Service Bus messages and publish through HTTPS.

Use [the Streams mount example](https://docs.bijection.com/integrations/native-kinesis.md) 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](https://docs.bijection.com/integrations/native-connectors.md#installer-bound-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](https://learn.microsoft.com/en-us/rest/api/servicebus/peek-lock-message-non-destructive-read)
and [Complete a locked message](https://learn.microsoft.com/en-us/rest/api/servicebus/delete-message).

## Observe a queue over AMQP 1.0

The [Streams socket mount](https://docs.bijection.com/integrations/native-kafka.md#mount-and-start)
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.

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "keyName": "InventoryListen",
  "key": "<shared access key>",
  "entity": "orders",
  "source": { "kind": "serviceBus", "incarnation": "orders-1" }
}
```

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](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-amqp-request-response)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.