0

I want to create a nodejs Azure Service Bus client to read from a topic, and I want my client to automatically register its subscription.

So @azure/service-bus allows to work with SB normally, yet does not allow to create a subscription. azure-sb does allow to create one and also operate on the bus.

Do I need to install both in my nodejs app? Both seem official package from Microsoft, however, I wonder what is the intended usage for both and intended future (will one replace the other?)

Kat Lim Ruiz
  • 2,425
  • 2
  • 26
  • 32

1 Answers1

1

To put things simply, azure-sb is the old SDK for managing Service Bus while @azure/service-bus is the new one.

There are a few differences in the two packages:

  • Protocol: azure-sb is a wrapper over Service Bus REST API (HTTP protocol) while @azure/service-bus makes use of AMQP protocol to communicate with Service Bus.
  • Features: azure-sb enables you to work with entities (Queues, Topics and Subscriptions) by allowing them to perform CRUD operations on them. These features were removed from @azure/service-bus as Microsoft is moving these CRUD operations under control plane by enforcing RBAC on these operations. For performing these operations, you will need to use @azure/arm-servicebus. @azure/service-bus package is more geared towards sending and receiving messages. It also supports Websockets in case you need that.

Do I need to install both in my nodejs app? Both seem official package from Microsoft, however, I wonder what is the intended usage for both and intended future (will one replace the other?)

Considering your requirement, my answer is yes. You would need both of these packages. I'm not sure if that will cause any problems. In our project, we ended up implementing REST API directly (instead of using azure-sb package) for CRUD operations on entities and used @azure/service-bus for working with messages.

Regarding @azure/service-bus will eventually replace azure-sb package, I will be purely speculating but I don't think that will happen anytime soon. For this, Service Bus team will have to remove the REST API first which seems highly unlikely however Microsoft is pushing hard for RBAC at entities level so I would recommend that you use @azure/arm-servicebus along with @azure/service-bus if you're starting new.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241