Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

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

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top