Hi,

I wrote up a sample message consumer app to test AMQ message processing
functionality.

The app creates a single broker connection and 3 consumer sessions, each
further creating a separate MessageConsumer object. The message consumers
are registered to a queue on the Broker. 

Before launching the consumer app, I get 5 messages posted to the queue
through another app (call it the producer app).

Now, on launching the consumer app, I expect the consumers to be started up
in three *different *threads, as each of them belong to a different session
( all the sessions ,however, share the same broker connection). So the 5
pending messages should get dispatched to three threads and processing
should happen concurrently.

However I find that the messages are getting processed sequentially in a
single thread by a single consumer. Could someone please explain the
sequential processing, as opposed to the expected concurrent processing?


Here's the consumer app code

http://activemq.2283324.n4.nabble.com/file/n4252635/TestAMQ.java
TestAMQ.java 

Following is the output. Note that all the messages got processed by
consumer cons_1, though all the three got created (each in a different
session)



Created consumer 1
 Created consumer 2
ActiveMQ Session Task-1 : : cons_1  Received message  'Msg ..........4'
 Created consumer 3
main : Created the consumers 
ActiveMQ Session Task-1 : cons_1 Processed message  'Msg ..........4'

ActiveMQ Session Task-1 : : cons_1  Received message  'Msg ..........3'
ActiveMQ Session Task-1 : cons_1 Processed message  'Msg ..........3'

ActiveMQ Session Task-1 : : cons_1  Received message  'Msg ..........2'
ActiveMQ Session Task-1 : cons_1 Processed message  'Msg ..........2'

ActiveMQ Session Task-1 : : cons_1  Received message  'Msg ..........1'
ActiveMQ Session Task-1 : cons_1 Processed message  'Msg ..........1'

ActiveMQ Session Task-1 : : cons_1  Received message  'Msg ..........5'
ActiveMQ Session Task-1 : cons_1 Processed message  'Msg ..........5'



--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Messages-getting-dispatched-in-a-single-thread-tp4252635p4252635.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to