Question

I understand that there are different ways (or permutations) to implementing a JMS Request-Reply mechanism, i.e. request queue and response queue, request topic and response topic, or a mix of either.

What I would like to know is, (1) what is the recommended (or most common) way and (2) how do the different permutations measure up?

Next, is it more correct to say a. "Send a message to a queue" or b. "Send a message through a queue"?

Cheers!

Was it helpful?

Solution

Normally, use a queue. "Request" implies a recipient, not a notice to anyone who cares, so you probably want the behaviour of a queue.

Queues usually do better for one thing - or a limited number of peer things - receiving the message and processing it. They also tend to saner persistence models than topic, when it matters that the message actually get to someone who processes it. (eg: if dropping the message is a problem, you probably want a queue)

Topics are more broadcast oriented: say something, and anyone who cares will hear about it. Normally that goes hand-in-hand with "...and no direct response is expected" because the "zero or more listeners" model ... well, zero listeners is always a problem if you expect a response.

Topics can do persistence, but the rules are stranger, and seldom what you actually want.

Finally, I think most people say "to" a queue, because the queue and the thing(s) processing messages off it are distinct, but really, it doesn't matter much as log as you convey your meaning.

OTHER TIPS

Also with a Queue you are able to have multiple subscribers process the messages so its kid of a built in loadbalancer. You cannot do this easily with a Topic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top