@imaness/bus-azure-service-bus
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@imaness/bus-azure-service-bus

An Azure Service Bus queue adapter for @node-ts/bus

🔥 View our docs at https://bus.node-ts.com 🔥

🤔 Have a question? Join our Discord 🤔

Installation

Install packages and their dependencies

npm i @imaness/bus-azure-service-bus @node-ts/bus-core

Once installed, configure Bus to use this transport during initialization:

import { Bus } from '@node-ts/bus-core'
import { ServiceBusTransport, ServiceBusTransportConfiguration } from '@imaness/bus-azure-service-bus'

// For Using Service Bus Queue
const sbQueueConfiguration: ServiceBusTransportConfiguration = {
  queueName: {Queue Name},
  serviceBusClient:  new ServiceBusClient(),
}
const sbQueueTransport = new ServiceBusTransport(sbConfiguration)

// For Using Service Bus Topic
const sbTopicSubscriptionConfiguration: ServiceBusTransportConfiguration = {
  topicName: {Topic Name},
  subscriptionName: {Subscription Name},
  serviceBusClient:  new ServiceBusClient()
}
const sbTopicTransport = new ServiceBusTransport(sbConfiguration)

// Configure Bus to use Azure Service Bus Queue as a transport
const run = async () => {
  await Bus
    .configure()
    .withTransport({ sbQueueTransport or sbTopicTransport })
    .initialize()
}
run.catch(console.error)

Mapping of ApplicationProperties to Attributes and StickyAttributes

Azure Service Bus supports Message Properties.

In order for you to map it to Attributes or StickyAttributes you need to add key prefix of either attributes or stickyAttributes. Those key that are not have the said prefixes will be considered as attributes.

Package Sidebar

Install

npm i @imaness/bus-azure-service-bus

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

27 kB

Total Files

19

Last publish

Collaborators

  • imaness