我在 MVC Controller 中使用来自 JmsMessagingTemplate 的 sendAndReceive,但如果没有发送回复消息,它似乎会永远等待回复。文档指出:
Returns: the reply, possibly null if the message could not be received, for example due to a timeout
但是我无法弄清楚超时时间是多少,也不知道在哪里配置。谁能给我解释一下?
仅供引用:我没有使用 spring-integration,而是 spring-messaging。
最佳答案
你可以通过JmsTemplate在创建 JmsMessagingTemplate 时
在 JmsTemplate
中你可以配置 property setReceiveTimeout(long receiveTimeout)
其中时间以毫秒为单位
关于java - 如何在 JmsMessagingTemplate.sendAndReceive 上设置等待超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33375681/