Contact Us 1-800-596-4880

Migrating the Poll Component

In Mule 3, the <poll> element was used to trigger a certain flow at a fixed frequency of time. This element was also a scope which required one (and only one) message processor to live inside of it. The output of that processor would be the message that the flow receives.

Mule 3 Example: Poll
<flow name="poll>
    <poll frequency="1000">
        <db:select config-ref="MySQL_Configuration">
            <db:parameterized-query>SELECT * FROM PERSON></db:parameterized-query>
        <db:select>
    </poll>

    <flow-ref name="doProcess" />
</flow>

In Mule 4, the <poll> element was replaced with the <scheduler> element. Main differences are:

  • It just triggers the flow. It’s no longer a scope

  • It supports both fixed frequency and cron expressions

Mule 4 Example: Scheduler
<flow name="poll>
    <scheduler>
        <scheduling-strategy>
            <fixed-frequency frequency="1000"/>
        </scheduling-strategy>
    </scheduler>

    <db:select config-ref="MySQL_Configuration">
        <db:sql>SELECT * FROM PERSON></db:sql>
    <db:select>

    <flow-ref name="doProcess" />
</flow>

For more information on the <scheduler> element, please read the Scheduler documentation.

Migrating a Watermark

The <poll> element also supported a <watermark> element which was used to aid and scheduled synchronizations. That element doesn’t exist anymore. Instead, please read the Migrating Watermarks page.

Quartz Transport

In Mule 3, a quartz transport existed that was deprecated in favor of the poll, so most of its uses may also be replaced by the scheduler in Mule 4.

Some features of the quartz transport do not exist in Mule 4, so a different approach is necessary to migrate those use cases.

repeatCount

repeatCount is not supported in Mule 4 by the scheduler.

If you really need to fetch it, compare and store a counter in an Object Store.

quartz:outbound-endpoint

This endpoint is not supported in Mule 4.

An alternative approach is to write the events to a queue (JMS or VM, for instance) and have another flow with a Scheduler that consumes all the messages from the queue and processes them.

Unsupported job-endpoint

The transport used in a job-endpoint, when migrated to a Mule 4, can be migrated to a connector that has a polling source (such as File). In that case, you can put the Scheduler configuration directly into the polling source.

Mule 3 Example: Polling source
<flow name="poll>
    <quartz:inbound-endpoint name="quartzInboundEndpoint"
        cronExpression="0/3 * * * * ?" jobName="cronJob">
        <quartz:endpoint-polling-job>
            <quartz:job-endpoint address="sftp://.../~/data" />
        </quartz:endpoint-polling-job>
    </quartz:inbound-endpoint>
    <flow-ref name="doProcess" />
</flow>
Mule 4 Example: Polling source
<flow name="poll>
    <sftp:listener config-ref="inboundEndpointConfig" directory="data">
        <scheduling-strategy>
            <cron expression="0/3 * * * * ?"/>
        </scheduling-strategy>
    </sftp:listener>
    <flow-ref name="doProcess" />
</flow>