Scheduled Poll Components - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

Quite a few inbound Camel endpoints use a scheduled poll pattern to receive messages and push them through the Camel processing routes. That is to say externally from the client the endpoint appears to use an Event Driven Consumer but internally a scheduled poll is used to monitor some kind of state or resource and then fire message exchanges. Since this is such a common pattern, polling components can extend the ScheduledPollConsumer base class which makes it simpler to implement this pattern.

The ScheduledPollConsumer supports the following options:

Option

Default

Description

pollStrategy

A pluggable org.apache.camel. PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. In other words the error occurred while the polling was gathering information, for instance access to a file network failed so Camel cannot access it to scan for files. The default implementation will log the caused exception at WARN level and ignore it.

sendEmptyMessage-WhenIdle

false

If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead.

initialDelay

1000

Milliseconds before the first poll starts.

delay

500

Milliseconds before the next poll of the file/directory.

useFixedDelay

true

Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.

timeUnit

TimeUnit. MILLISECONDS

Time unit for initialDelay and delay options.

runLoggingLevel

TRACE

The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.

scheduledExecutor-Service

null

Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool. This option allows you to share a thread pool among multiple consumers.

greedy

false

Camel 2.10.6/2.11.1: If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages.

scheduler

null

Camel 2.12: Allow to plugin a custom org.apache.camel.spi.ScheduledPoll

ConsumerScheduler to use as the scheduler for firing when the polling consumer runs. The default implementation uses the ScheduledExecutorService and there is a Quartz2, and Spring based which supports CRON expressions. Notice: If using a custom scheduler then the options for initialDelay, useFixedDelay, timeUnit, and scheduledExecutorService may not be in use. Use the text quartz2 to refer to use the Quartz2 scheduler; and use the text spring to use the Spring based; and use the text #myScheduler to refer to a custom scheduler by its id in the Registry. See Quartz2 page for an example.

scheduler.xxx

null

Camel 2.12: To configure additional properties when using a custom scheduler or any of the Quartz2, Spring based scheduler.

backoffMultiplier

0

Camel 2.12: To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.

backoffIdleThreshold

0

Camel 2.12: The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.

backoffErrorThreshold

0

Camel 2.12: The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.