JMSTemplate 没有收到我之前发送的字符串?

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

我有一个 JMSTemplate jmsT。为了测试它,我仅有的两行代码是:

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

代码在 receiveAndConvert 停止,永远等待接收一条消息,就好像它不存在一样,尽管这正是上一行创建的内容。

如果您使用的是嵌入式 ActiveMQ,则必须使用 CachingConnectionFactory。否则嵌入式代理将在两次调用之间消失。

DEBUG 日志记录永远是您的朋友。