activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bain <tb...@alumni.duke.edu>
Subject Re: Concurrent message consumption in ActiveMQ
Date Thu, 07 May 2015 02:37:31 GMT
Are you saying you want C1 to consume only P1's messages and C2 to consume
only P2's messages?  In that case either use selectors or message groups
(but I think there's a risk that one consumer will end up with both groups
and the other will sit idle) or two separate queues.  Selectors are
probably the easiest option, but the others would work.

Or are you saying that both C1 and C2 should each get copies of the
messages from both P1 and P2?  In that case, use a topic instead of a queue.
On May 6, 2015 9:22 AM, "sarge" <agajdy@gmail.com> wrote:

> Hi, I use a ActiveMQServer as a broker.
>
> Server.java <http://pastebin.com/RUZ5ZiZx>
>
> and I have a Client.java class, where I create a queue, message producer
> and
> message consumer.
>
> Client.java <http://pastebin.com/VpbysKca>
>
> In this main I create one queue, two producers and two consumers.
>
> main <http://pastebin.com/crqpvtUB>
>
> and this is the output of main:
>
> /Producer is going to send a message
> client cl1 received message 05/06/2015 16:56:22 number of iteration 0
> Producer is going to send a message
> client cl2 received message 05/06/2015 16:56:24 number of iteration 1
> Producer is going to send a message
> client cl1 received message 05/06/2015 16:56:26 number of iteration 2
> Producer is going to send a message
> client cl2 received message 05/06/2015 16:56:28 number of iteration 3
> Producer is going to send a message
> client cl1 received message 05/06/2015 16:56:30 number of iteration 4
> Producer is going to send a message
> client cl2 received message 05/06/2015 16:56:32 number of iteration 5
> Producer is going to send a message
> client cl1 received message 05/06/2015 16:56:34 number of iteration 6
> Producer is going to send a message
> client cl2 received message 05/06/2015 16:56:36 number of iteration 7
> Producer is going to send a message
> client cl1 received message 05/06/2015 16:56:38 number of iteration 8
> Producer is going to send a message
> client cl2 received message 05/06/2015 16:56:40 number of iteration 9
> client cl2 received message 05/06/2015 16:56:22 number of iteration 0
> client cl2 received message 05/06/2015 16:56:26 number of iteration 2
> client cl2 received message 05/06/2015 16:56:30 number of iteration 4
> client cl2 received message 05/06/2015 16:56:34 number of iteration 6
> client cl2 received message 05/06/2015 16:56:38 number of iteration 8/
>
> I would like to ask, how can I make concurrent message consumption for all
> consumers.
>
> I mean:
>
> /client cl1 received ... message of iteration 0
> client cl2 received ... message of iteration 0
> client cl1 received ... message of iteration 1
> client cl2 received ... message of iteration 1/
>
> I found prefetch limit settings, but don't know how to use
> ActiveMQConnectionFactory and ActiveMQConnection classes without
> refactoring
> in client.java class. Is there any other options to make message
> consumption
> concurrent for all consumers?
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Concurrent-message-consumption-in-ActiveMQ-tp4696175.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message