1
votes

I have a requirement where I want to poll JMS queue every 5 minutes and consumes all messages that are there in the jms queue. I am trying to do this in mule as following :

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

Above code is working but its ignoring the pollingFrequency attribute.

Can someone help me how to set the polling frequency for JMS queue in Mule?

Above issue is resolved. But with my fix, I am getting below exception:

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)

Please help me to fix this issue.

Thanks, vkumar

1
Are you Using it with the XaTransactedJmsMessageReceiver or with JBoss?AlessandroEmm
I am using TransactedPollingJmsMessageReceiver as follow : <service-overrides transactedMessageReceiver="com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver" />user2324686
I resolved above issue. I was missing one JMS Transaction declaration. <jms:transaction action="ALWAYS_BEGIN"/> Now I am facing other issue: WARN 2013-05-01 11:02:57,044 [jmsConnector.receiver.72] org.mule.transport.jms.JmsConnector: Jms connection failed to stop properly: javax.jms.IllegalStateException: The connection is closed. at progress.message.jimpl.Connection.getJMSObjectClosedException(Connection.java:2328). Help me fixing this issueuser2324686

1 Answers

0
votes

have you tried by increasing the response timeout enter image description here

You can also configure the Reconnection Strategy if your connection is lost