Philip Ware
Philip Ware

Reputation: 21

Creating subscriptions on Azure ServiceBus with QPID JMS (AMQP 1.0)

The servicebus client 2.1 now supports AMQP 1.0.

On MSDN there is an article about how to use QPID.AMQP.JMS with Azure ServiceBus.

However, although I can connect to a predefined Topic and a Subscription, post messages and receive all of them, I cannot change the message selector or create a new topic/subscription.

My goal is to be able to connect to a Topic and dynamically create subscriptions based on different filters using org.apache.qpid.amqp_1_0.jms.

Questions:

1/ How can I create a new topic.

Topic newTopic = (Topic) session.createTopic("newtopic");
session.createProducer(newTopic); // returns error

2/ How can I create a new subscription with a different message selector via Jms?

// This still gives me all messages no matter what I put in the 'class' property.
TopicSubscriber subscriber = session.createDurableSubscriber(topic, "sub1", "class = 'boo'", false);

Thanks, Phil.

Upvotes: 2

Views: 1087

Answers (1)

Ramiro Berrelleza
Ramiro Berrelleza

Reputation: 2405

The AMQP 1.0 protocol deliberately left entity creation / management outside of it's scope, you'll need to create your topics and subscriptions beforehand using provider-specific mechanics for this (This post has a good explanation on why).

In the case of Service Bus, you can either use the Azure SDK, the portal (in case you don't need to do it programmatically), or their REST API for this.

Hope it helps!

Upvotes: 3

Related Questions