英文:
how to poll for messages from AMQ queue at every 30 minutes Mule-4
问题
请问有人可以指导我一下吗?每当流程中的消息失败时,我们会将其放入死信队列。我需要每天重新处理一次消息。因此,我需要每天在某个特定时间轮询队列。我正在使用以下配置的JMS消费者:
<jms:consume doc:name="Consume" doc:id="e63155ec-7563-4409-bd83-c66e6e1c792a" config-ref="AMQ-DocuSign-Connector" destination="${amq.docusign.reports.bqueue}" maximumWaitUnit="SECONDS" maximumWait="0">
<jms:consumer-type>
<jms:queue-consumer />
</jms:consumer-type>
</jms:consume>
但它每秒或更短时间轮询一次。我需要按给定时间间隔轮询队列中的消息。如果我增加等待时间,那么在指定的时间后会抛出超时错误。
甚至在流程的源头使用调度器也不起作用。以下是参考代码:
<flow name="message-reprocessing-reports-subflow" doc:id="f3ffe923-ee3e-4e0d-8a29-ec874b9755d7" >
<scheduler doc:name="Scheduler" doc:id="ff715c36-be3e-4f79-bdc9-db7934c75985" >
<scheduling-strategy >
<fixed-frequency frequency="${jms.message.reprocessing.polling.interval.in.seconds}" startDelay="${jms.message.reprocessing.polling.initial.delay.in.seconds}"/>
</scheduling-strategy>
</scheduler>
<set-variable value="${amq.docusign.reports.bqueue}" doc:name="Set Variable" doc:id="a521f360-8722-4e84-a5da-6b90f51d437b" variableName="blockQueue" />
<jms:consume doc:name="Consume" doc:id="e63155ec-7563-4409-bd83-c66e6e1c792a" config-ref="AMQ-Connector" destination="${amq.bqueue}" maximumWaitUnit="SECONDS" maximumWait="0">
<jms:consumer-type>
<jms:queue-consumer />
</jms:consumer-type>
</jms:consume>
</flow>
任何帮助都将不胜感激。
英文:
can some one guide me on this. when ever a message fails in flow we are dropping that in Dead Letter Queue. I need to reporesess the message daily once. For this reason I need to poll the queue daily once at some time. I am using JMS consume with the following configuration
But it is polling for every second or less than that. I need to poll the queue for message at a given interval of time. if I increased wait time then it is throwing time out error after specified time.
<jms:consume doc:name="Consume" doc:id="e63155ec-7563-4409-bd83-c66e6e1c792a" config-ref="AMQ-DocuSign-Connector" destination="${amq.docusign.reports.bqueue}" maximumWaitUnit="SECONDS" maximumWait="0">
<jms:consumer-type>
<jms:queue-consumer />
</jms:consumer-type>
</jms:consume>
any help is much appreciated
edit:
even using scheduler at source of the flow is not working. here is the code for reference
<flow name="message-reprocessing-reports-subflow" doc:id="f3ffe923-ee3e-4e0d-8a29-ec874b9755d7" >
<scheduler doc:name="Scheduler" doc:id="ff715c36-be3e-4f79-bdc9-db7934c75985" >
<scheduling-strategy >
<fixed-frequency frequency="${jms.message.reprocessing.polling.interval.in.seconds}" startDelay="${jms.message.reprocessing.polling.initial.delay.in.seconds}"/>
</scheduling-strategy>
</scheduler>
<set-variable value="${amq.docusign.reports.bqueue}" doc:name="Set Variable" doc:id="a521f360-8722-4e84-a5da-6b90f51d437b" variableName="blockQueue" />
<jms:consume doc:name="Consume" doc:id="e63155ec-7563-4409-bd83-c66e6e1c792a" config-ref="AMQ-Connector" destination="${amq.bqueue}" maximumWaitUnit="SECONDS" maximumWait="0"><jms:consumer-type><jms:queue-consumer /></jms:consumer-type></jms:consume></flow>
答案1
得分: 0
JMS Consume 操作不是用于这种方式的。它在执行时期望读取消息。您增加的时间只是一个超时时间。它不会轮询消息。相反,要在所需的时间仅内读取消息,您可以将 <jms:consume>
操作放在一个流程内,并放置一个 Scheduler 源以触发该流程。将调度程序设置为所需的频率。
<flow name="pollJMS">
<scheduler doc:name="Scheduler">
<scheduling-strategy>
<fixed-frequency frequency="30" timeUnit="minutes"/>
</scheduling-strategy>
</scheduler>
<jms:consume ... />
</flow>
英文:
The JMS Consume operation is not intended to be used that way. It expects to read a message when executed. The time that you are increasing is just a time out. It doesn't poll for messages. Instead to read message at your desired time only you can put the <jms:consume>
operation inside a flow and put a Scheduler source to trigger that flow. Set the Scheduler to the desired frequency.
<flow name="pollJMS" >
<scheduler doc:name="Scheduler" >
<scheduling-strategy>
<fixed-frequency frequency="30" timeUnit="minutes"/>
</scheduling-strategy>
</scheduler>
<jms:consume ... />
</flow>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论