2013-04-26 62 views
1

我有一個要求,我希望每5分鐘輪詢一次JMS隊列並消耗jms隊列中的所有消息。我想這樣做是騾子如下:設置騾隊jms隊列的輪詢頻率

 <jms:inbound-endpoint queue="jmsqueue" exchange-pattern="one-way" > 
      <properties> 
        <spring:entry key="pollingFrequency" value="100000" /> 
      </properties> 
     </jms:inbound-endpoint> 

上面的代碼工作,但它忽略了pollingFrequency屬性。

有人能幫助我如何設置穆勒JMS隊列的輪詢頻率?

上述問題已解決。但隨着我的修復,我得到以下異常:

WARN 2013-05-01 15:04:05,268 [jmsConnector.receiver.14] com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver: Error in TX notification handler. 
javax.jms.IllegalStateException: The session is closed. 
    at progress.message.jimpl.Session.getJMSObjectClosedException(Session.java:3341) 
    at progress.message.jimpl.Session.commit(Session.java:1022) 
    at progress.message.jimpl.Session.commit(Session.java:1008) 
    at progress.message.jimpl.Session.commit(Session.java:969) 
    at com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver$2.onNotification(TransactedPollingJmsMessageReceiver.java:314) 
    at com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver$2.onNotification(TransactedPollingJmsMessageReceiver.java:298) 
    at org.mule.context.notification.Sender.dispatch(Sender.java:40) 
    at org.mule.context.notification.Policy.dispatch(Policy.java:122) 
    at org.mule.context.notification.ServerNotificationManager.notifyListeners(ServerNotificationManager.java:249) 
    at org.mule.context.notification.ServerNotificationManager.fireNotification(ServerNotificationManager.java:200) 
    at org.mule.DefaultMuleContext.fireNotification(DefaultMuleContext.java:435) 
    at org.mule.transaction.AbstractTransaction.fireNotification(AbstractTransaction.java:144) 
    at org.mule.transaction.AbstractTransaction.commit(AbstractTransaction.java:83) 
    at org.mule.transaction.AbstractSingleResourceTransaction.commit(AbstractSingleResourceTransaction.java:79) 
    at org.mule.transaction.TransactionCoordination.resolveTransaction(TransactionCoordination.java:222) 
    at org.mule.execution.BeginAndResolveTransactionInterceptor.resolveTransactionIfRequired(BeginAndResolveTransactionInterceptor.java:77) 
    at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:59) 
    at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48) 
    at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54) 
    at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44) 
    at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44) 
    at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52) 
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32) 
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17) 
    at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113) 
    at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34) 
    at com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver.poll(TransactedPollingJmsMessageReceiver.java:110) 
    at org.mule.transport.AbstractPollingMessageReceiver.performPoll(AbstractPollingMessageReceiver.java:219) 
    at org.mule.transport.PollingReceiverWorker.poll(PollingReceiverWorker.java:84) 
    at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:53) 
    at org.mule.work.WorkerContext.run(WorkerContext.java:311) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 

請幫我解決這個問題。

感謝, vkumar

+0

你與XaTransactedJmsMessageReceiver或與JBoss使用它試圖? – AlessandroEmm 2013-04-26 18:25:49

+0

[mule - 如何從週期性基礎(石英)作業上的jms隊列中消耗所有消息的可能重複(http://stackoverflow.com/questions/16241300/mule-how-to-consume-all-messages-from- jms-queue-on-periodic-basesquartz-job) – 2013-04-27 07:05:26

+0

我正在使用TransactedPollingJmsMessageReceiver,如下所示: user2324686 2013-04-29 14:12:43

回答

0

你通過提高響應超時enter image description here

您還可以配置重新連接策略,如果你的連接丟失