Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure ServiceBus: all topic subscribers must process message

I'm just starting to use Azure ServiceBus. One thing is not fully clear to me, and I'm having a hard time finding an answer.

If I call message.Complete() on a subscription message, does that mean that this message will not be delivered to any other subscribers anymore, or am I only completing this message for the current subscriber? In other words, does the service bus keep track of messages per subscriber, or per subscription?

In my particular use case, I would want the message to be processed by all subscribers, not just by any/one subscriber. Is this at all possible with topics?

like image 426
Carvellis Avatar asked Feb 18 '17 15:02

Carvellis


1 Answers

Your question was already answered, but there seem to be a confusion in terms (subscription\subscriber), and what's the recommended use case.

Consider a simple queue where in one end you put messages, and on the other end you pop them. This is how a ServiceBus queue behaves.
Now consider a queue where you still put messages in one end, but then it splits onto multiple ends that you can pop messages from. This describes a topic (where you put messages) and a subscription (where you pop messages).

In a topic\subscription, the messages in the topic are copied to the subscription. So each subscription is independent of the other subscription. It's like a different copy of the queue.

Now, your client applications that are receiving messages from a subscription are what you called subscribers. Each client (subscriber) is meant to connect to a single subscription. In this case, subscribers do not compete for messages, and each subscriber can process the same message as others did.

On the other hand, if you have many client applications (subscribers) that connect to the same subscription, then naturally they all compete for the same messages.

Hopefully this explained the answers you got (which appear to be conflicting but really just use same terms differently). Bottom line is eventually you can do both scenarios with ServiceBus.

like image 122
itaysk Avatar answered Sep 29 '22 08:09

itaysk