Mule Quartz调度程序:处理多个消息 [英] Mule Quartz scheduler: process multiple messages

查看:357
本文介绍了Mule Quartz调度程序:处理多个消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是在4个月前提出的.

This question was asked 4 months ago.

https://stackoverflow.com/posts/16241300/edit

有人吗?

我已经在m子流中编写了一个石英代码,每5分钟使用一次队列中的所有消息.

"I have written a quartz code in mule flow to consume all the messages from queue every 5 minutes.

<quartz:inbound-endpoint jobName="abc" cronExpression="0 0/1 * * * ?" doc:name="Quartz">
               <quartz:endpoint-polling-job>
                     <quartz:job-endpoint ref="jmsEndPoint" />
               </quartz:endpoint-polling-job>
        </quartz:inbound-endpoint>

但是上面的代码一次只消耗一条消息,即使队列中有5条消息.

But this above code consumes only one message at a time even if there are 5 messages in the queue.

我的要求是每5分钟运行一次作业,并消耗队列中的所有消息.

My requirement is to run a job every 5 minutes and consumes all the messages from queue.

另一个要求是使用唯一标识符从消息有效负载中过滤出重复的消息.

Another requirements is to filter out duplicate messages using unique identifier from within the message payload.

任何帮助将不胜感激. "

Any help will be appreciated. "

JMS端点

<jms:endpoint name="jmsEndPoint" queue="MyQueue" connector-ref="connector"/>

推荐答案

队列是基于事件的,旨在仅返回一条消息(先进先出).为了使用Mule流中的队列中的所有消息,一种方法是创建一个自定义组件,该组件将以编程方式使用队列中的jms消息,直到没有更多消息为止.

Queues are event based and are designed to return just one message (first in first out). In order to consume all messages from form a queue in a Mule flow, one approach is to create a custom component which will programmatically consume a jms message from a queue until there are no more messages.

为了过滤重复的消息,请考虑使用Mule的幂等路由器:

In order to filter duplicate messages, consider using Mule's idempotent router:

http://www.mulesoft.org/documentation/display/current/Routing + Message + Processors#RoutingMessageProcessors-IdempotentMessageFilter

HTH

这篇关于Mule Quartz调度程序:处理多个消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆