Is it possible to connect to partitioned topic in Azure Service Bus with AMQP.Net Lite library?

265 views Asked by At

My client .NET Core application uses AMQP.Net Lite library to work with Azure Service Bus. When the topic in the service bus namespace is NOT partitioned (Enable Partitioning is turned OFF), everything works fine - I'm able to connect and create ReceiverLink object to receive messages.

However, as soon as the topic is partitioned (Enable Partitioning is turned ON), I get the following error immediately after ReceiverLink object creation. The error description is: "Cannot open a Topic client for entity type Subscriber."

The error code translates to the AMQP map as amqp:not-allowed. According to the docs, it means "The peer tried to use a frame in a manner that is inconsistent with the semantics defined in the specification." To be honest, I can hardly understand what it means in terms of Azure Service Bus abstractions, but it sounds depressing and similar to "not possible" to me...

On the other hand, the MS docs state that AMQP can be used to send and receive messages:

AMQP is now supported for sending and receiving messages to and from a partitioned entity.

So, the question is whether it is at all possible to use AMQP.NET Lite library to receive messages from a partitioned topic in Azure Service Bus?

2

There are 2 answers

0
Yan Sklyarenko On BEST ANSWER

Apparently, it turns out to be a bug in Azure Service Bus. There's a workaround, however.

Instead of creating the ReceiverLink like this:

var r = new ReceiverLink(session, "SubscriptionName", "TopicName");

Create it like this:

var r = new ReceiverLink(session, string.Empty, "TopicName/Subscriptions/SubscriptionName");

NOTE: the second parameter can be any string.

See this Github thread for details.

1
Pranav Singh On

On the other hand, the MS docs state that AMQP can be used to send and receive messages:

AMQP is now supported for sending and receiving messages to and from a partitioned entity

This article from Microsoft docs is published in 23rdJun, 2020: enter image description here

But last update on AMQP.Net Lite library is 5 Months ago, so it's unlikely that support is present right now and is yet to be added to open source library:

enter image description here

You can either raise a pull request or issue for the support in Github repo