rmn190
rmn190

Reputation: 611

activemq consumer does not receive message when running in JUnit?

enter image description here

with the above consumer.class, when it runs in JUnit , it cannot receive message. but when running via main method directly, it works well. The following is the invoking code:

enter image description here

and the JUnit version is 4.10.

So, would anyone give some point? Thanks a lot in advance!

Of course, when running the two invocation, the JMS server has enough messages waiting for consumption.

Upvotes: 1

Views: 1102

Answers (1)

Ben ODay
Ben ODay

Reputation: 21015

since your testMq() method just registers a listener and doesn't block the test thread, the test case will just stop. try adding Thread.sleep(10000) after the listener is registered but before the test case ends...

Upvotes: 3

Related Questions