Azure ServiceBus provides both queues and topics for the messaging. I want to know if instead of an application subscribing to a topic, can I queue do that? can we receive the topic messages into queue?
1 Answers
Queues are for unicast operations, sending to a specific single destination. Topics are for multicast operations, broadcasting.
You cannot subscribe to a queue, only listen to it. You can subscribe to a topic and then... listen to it. The difference is in who else can receive messages sent to a queue vs topic.
When a message is sent to a queue, it will be received by one listener only (assuming listener successfully processes and completes the message).
When a message is sent to a topic (also called "published"), every single subscriber will get a copy of that message.
can we receive the topic messages into queue?
Yes you can. You can enable Auto Forwarding on one of the subscriptions and point to the destination queue. It doesn't have to be a queue, could be another topic. Important thing to remember is that Azure Service Bus broker will protect from excessive auto-forwarding by limiting it to up to 3 hops at most.