activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drjava <>
Subject Lost messages - not all messages sent to the queue are delivered to the message receiver
Date Thu, 12 Jun 2008 16:33:27 GMT

I am using ActiveMQ embedded in my Junit test.
I have a JmsMessenger that uses a JmsTemplate to send the messages and a
MessageReceiver to receive the messages.
The test goal is to verify that all messages that were sent were also
received (compare numbers and the actual message objects for equality).

How it works: send out 100 unique messages (using a SingleConnectionFactory)
The MessageReceiver intercepts them and collects them in a List. 
Compare that the total received and sent are equal.
Compare the received list's items to the sent ones, make sure the messages
did not get corrupted.

However, on each and every run the test fails on the first assertion -
comparing the total sent and received numbers. 

Moreover this - on each run the total received number is different. (after
sending is complete the main thread awaits for 1 minute, which I consider a
long enough time to intercept 100 messages, so that the receiver gets the
opportunity to catch up)

According to the JmsTemplate all messages are successfully sent (the call to
convertAndSend is surrounded by a try/catch block and no JmsException is
being caught).

Emvironment details:
IDE - eclipse 3.3.2
test runner - Junit 4.4
ActiveMQ version - 5.1.0
VM - Java 1.6_0_06
OS - Windows XP 64bits
hardware - Dell Intel dual core, 2.66GH, 3.93 GB of RAM

Perhaps I don't fully understand how to best use Active MQ embedded in my
test. Are there any special settings of the broker's properties I should

I am attaching a few files to support understanding of my test scenario:

spring-config.xml (this configures the jms template and the message receiver
and jms messenger and all the rest) spring-config.xml the test class 
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message