Most people say that Queue - One sender and one receiver Pub/Sub - One sender and multiple receiver. I don't think this is a rule. Because of the fact that any number of clients can send messages to a Queue or a topic. So the number of senders can be anything. Whereas a Queue is intended for a single receipient and Topic is intended for multiple clients. JMS doesn't define the behavior for multiple clients listening to the queue, but it's intended for a single client. My question boils down to the number of senders in both cases. Is the number of senders is one or multiple in both cases? Thanks Raj
Joined: Jul 18, 2001
Originally posted by Raj Rad: Most people say that Queue - One sender and one receiver Pub/Sub - One sender and multiple receiver.
You are mixing terminology. It is: Point-to-Point - One sender to One Receiver Publish-Subscribe - One sender to Many Receivers To do Point-to-Point in JMS you typically use a Queue and to do Publish-Subscribe you typically use a Topic, though both could be implemented with either. Using a Queue one sender to one receiver is guaranteed, meaning a single message will only ever be consumed by one receiver. Many producers may send messages to the same Queue, however each message will only be consumed by a single consumer. Using a Topic one sender to many receivers is guaranteed, meaning a single message will be consumed by ALL subscribers. Many producers may send messages to the same Topic and each message will make its way to each consumer.
Joined: May 20, 2002
I understand your explaination and thanks for the same. But in both cases, the number of senders can be more than one, right? For example an Order processing system and a Stock trading system both can post Order confirmation and a trade confirmation to a single 'Response' queue. A single response processing system can fetch the messages and notify the clients appropriately. My concern is the exam point of view. Should I say both domains always have 'single' sender? Thx Raj