Search code examples
mulepollingcloudhub

mule - cron-scheduler poll


I am using the cron-scheduler inside poll for running the scheduled jobs on daily basis. My problem is, this Poller is not get initiates as soon as the application is up & running. Here my requirement is as soon as application is up for the first time Poll should start running the job. Then after its should run daily basis. Currently after deployment on CloudHub I have to "Run Now" the scheduler manually by going into Scheduler inside the application deployed on CloudHub. Any alternative? Thanks.

UPDATE

<quartz:connector name="QuartzConnector" doc:name="Quartz" validateConnections="true">
</quartz:connector>
<flow name="TestScheduleServiceFlow" >
    <quartz:inbound-endpoint jobName="QuartzScheduler" connector-ref="QuartzConnector" doc:name="QuartzInbound" repeatCount="10"  startDelay="0" cronExpression="0 0 12 * * ? *">
        <quartz:event-generator-job groupName="TestScheduler" jobGroupName="TestScheduler">
            <quartz:payload>This is a job scheduler that will write to file after every 10 seconds.</quartz:payload>
        </quartz:event-generator-job>
    </quartz:inbound-endpoint>
    <logger level="INFO" doc:name="Logger" message="This flow will be launched once at startup of the application"/>
</flow> 

Solution

  • If you are using Quartz connector add start delay as startDelay="0". This will trigger your flow on startup.

    For poll connector it's possible for fixed frequency poll using start delay as startDelay="0" but if you are using Cron schedular there there is no direct option. But you can write another flow to call your flow using Quartz connector poll with startDelay="0" and repeatCount="0". This will ensure that your flow is triggered on startup and triggered as per cron schedule.