adisplayname
adisplayname

Reputation: 127

JMSTemplate doesn't receive the String I sent right before?

I have a JMSTemplate jmsT. To test it out, my only two lines of code are:

jmsT.convertAndSend("Location", "Message");
jmsT.receiveAndConvert("Location");

The code stalls at receiveAndConvert, waiting forever to receive a message as if it doesn't exist, despite that being exactly what the previous line creates.

Upvotes: 0

Views: 286

Answers (1)

Gary Russell
Gary Russell

Reputation: 174564

If you are using an embedded ActiveMQ, you must use a CachingConnectionFactory. Otherwise the embedded broker will go away between the two calls.

DEBUG logging is always your friend.

Upvotes: 1

Related Questions