For the complete documentation index, see llms.txt. This page is also available as Markdown.

Azure Service Bus

Azure Service Bus Integration

This guide explains how to configure and use Azure Service Bus in your messaging-based application using @nestjstools/messaging.


πŸ“¦ Installation

Make sure you’ve installed the following dependencies:

npm install @nestjstools/messaging @nestjstools/messaging-azure-service-bus-extension
or
yarn add @nestjstools/messaging @nestjstools/messaging-azure-service-bus-extension

πŸ› οΈ Channel Configuration

Basic Setup queue

channels: [
  new AzureServiceBusChannelConfig({
    name: 'azure-channel',
    connectionString: 'Endpoint=sb://your-namespace.servicebus.windows.net/;SharedAccessKeyName=...;',
    queue: 'your-queue-name',
    autoCreate: false, // Requires admin permission
    enableConsumer: true,
  }),
],

Topic/Subscription Example


βš™οΈ Config Options

Property
Description
Default

name

Internal channel name

β€”

connectionString

Azure Service Bus connection string

β€”

queue

Queue name (required for Mode.QUEUE)

β€”

topic

Topic name (required for Mode.TOPIC)

β€”

subscription

Subscription name (required for Mode.TOPIC)

β€”

mode

'queue' or 'topic'

'queue'

autoCreate

Auto-create queue/topic/subscription (requires admin permissions)

false

enableConsumer

Enable message receiving

true


πŸ“€ Dispatching a Message


βœ… Tips

  • autoCreate works only if the channel has enableConsumer = true and the connection string has management permissions.

  • Use mode: Mode.TOPIC only when using topic and subscription.

Last updated

Was this helpful?