-
1. Re: concurrently consuming messages from a topic
jbertram Oct 1, 2012 2:08 PM (in response to tbriot)Two different consumers cannot be connected to the same durable subscription concurrently. That violates the JMS specification. However, you can create multiple durable subscriptions with different identifiers and both subscriptions will receive the message.
You could also just use non-durable subscriptions.
-
2. Re: concurrently consuming messages from a topic
tbriot Oct 1, 2012 2:29 PM (in response to jbertram)Hi Justin,
Thanks for your response.
- I can't use multiple durable subscriptions with different ids otherwise each of my clients will receive the message. I only want the message to be processed by one of the client.
- In my clients' vendor documentation, here is what i found :
"The Java Message Service, Version 1.1 specifies that each subscriber to the same topic receives each message. The Java Message Service, Version 1.1 does not provide semantics regarding how to concurrently consume messages published to a topic in a load-balanced fashion.
Some JMS providers work around this limitation by offering a proprietary extension to the JMS API. Review your JMS provider’s documentation to determine how to concurrently consume messages from a topic."
Does it mean that HornetQ doesn't offer that kind of extension ? (i can see that the webMethods JMS provider has this feature for instance)
Thanks.
Regards,
Thomas
-
3. Re: concurrently consuming messages from a topic
jbertram Oct 1, 2012 3:19 PM (in response to tbriot)I'm not really clear on your use-case here. But you say,
I only want the message to be processed by one of the client.
If that is true then why not just a queue rather than a topic?
I don't understand what it means to, "concurrently consume messages published to a topic in a load-balanced fashion." For multiple consumers to consume messages "concurrently" would seem to mean that they consume them in parallel (i.e. simultaenously). To do so "in a load-balanced fashio" is what I don't understand. Does that mean that only one of the consumers actually gets the message and then the next message goes to the other consumer? If so, it again appears like you want a queue rather than a topic.
-
4. Re: concurrently consuming messages from a topic
tbriot Oct 1, 2012 3:56 PM (in response to jbertram)"Does that mean that only one of the consumers actually gets the message and then the next message goes to the other consumer?"
» exactly.
- You're right, a JMS queue would solve the problem. But we would lose the topic advantage of being able to have a new application subscribe to the topic and get the messages.
That's why we would like to stick to JMS Topics.
-
5. Re: concurrently consuming messages from a topic
jbertram Oct 1, 2012 4:04 PM (in response to tbriot)You're right, a JMS queue would solve the problem. But we would lose the topic advantage of being able to have a new application subscribe to the topic and get the messages.
That's why we would like to stick to JMS Topics.
You could solve this problem by creating a new queue for the new application and a matching non-exclusive divert to copy messages as necessary.
-
6. Re: concurrently consuming messages from a topic
tbriot Oct 1, 2012 5:20 PM (in response to jbertram)Looks like those divert objects could be helpful.
We're going to switch to a JMS queue.
Thank you very much Justin for your help.
Regards,
Thomas