Multiple triggers to Quartz endpoint in Mule

﹥>﹥吖頭↗ 提交于 2019-12-11 04:11:07

问题


Is there a way to configure a Quartz inbound endpoint in Mule to have multiple triggers? Say I want an event every day at 9:00, plus one at 1:00 a.m. on the first day of the month.


回答1:


Here is what you might work for you --

<flow name="MultipleIBEndpoints" doc:name="MultipleIBEndpoints">
    <composite-source doc:name="Composite Source">
        <quartz:inbound-endpoint jobName="QuartzDaily" doc:name="Quartz Daily"
            cronExpression="0 0 9 1/1 * ? *">
            <quartz:event-generator-job>
                <quartz:payload>dummy</quartz:payload>
            </quartz:event-generator-job>
        </quartz:inbound-endpoint>
        <quartz:inbound-endpoint  jobName="QuartzMonthly" doc:name="Quartz Monthly"
            cronExpression="0 0 1 1 1/1 ? *">
            <quartz:event-generator-job>
                <quartz:payload>dummy</quartz:payload>
            </quartz:event-generator-job>
        </quartz:inbound-endpoint>
    </composite-source>
    <logger level="INFO" doc:name="Logger" />
</flow>

The above flow uses composite source scope which allows you to embed into a single message source two or more inbound endpoints. In the case of Composite, the embedded building blocks are actually message sources (i.e. inbound endpoints) that listen in parallel on different channels for incoming messages. Whenever any of these receivers accepts a message, the Composite scope passes it to the first message processor in the flow, thus triggering that flow.




回答2:


You can do you requirement just by using one quartz endpoint with the required quartz endpoint

CRON Expression 0 0 1,21 1 * *

Please refer to the below link for more tweaks.

Mulesoft quartz reference

wikipedia reference

List of Cron Expression examples




回答3:


In that case you need to configure two crontrigger and add them to the scheduler. Please go through the below link where i have described the whole thing. Configure multiple cron trigger

Hope this will help.



来源:https://stackoverflow.com/questions/21269019/multiple-triggers-to-quartz-endpoint-in-mule

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!