我的java流程首先开始了它必须等到jms消息可用于activeMQ然后它应该读取JMS消息并执行java程序。我想要使用JMSTemplate。一旦执行,它应该退出。 我可以这样: 我可以使用while(msg == null)whithin,我可以接收msg并处理程序。最后我将使用System.exit
答案 0 :(得分:0)
我想是的。
在JmsTemplate
:
/**
* Receive a message synchronously from the default destination, but only
* wait up to a specified time for delivery.
* <p>This method should be used carefully, since it will block the thread
* until the message becomes available or until the timeout value is exceeded.
* <p>This will only work with a default destination specified!
* @return the message received by the consumer, or {@code null} if the timeout expires
* @throws JmsException checked JMSException converted to unchecked
*/
Message receive() throws JmsException;