2017-03-16 107 views
0

我的java進程首先啓動&它必須等到jms消息可用於activeMQ,然後它應該讀取JMS消息並執行java程序。我想使用JMSTemplate。一旦執行,它應該退出。 我可以這樣: 我可以使用while(msg == null),我可以接收msg並處理程序。最後我會用System.exitSpring批處理/集成 - 接收消息

回答

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; 
+0

謝謝,阿爾喬姆 – Raheem

+0

如果這是有幫助的,這個怎麼樣? http://stackoverflow.com/help/someone-answers –

相關問題