Batch Consumer
Batch Consumer is basically a Polling Consumer that is capable of polling multiple Exchanges in a single pool.
To support batching the consumer must implement the org.apache.camel.BatchConsumer
interface.
A range of Camel components support batching such as:
Options
The BatchConsumer
supports the following options:
Option | Description |
---|---|
| An integer to define a maximum messages to gather per poll. By default, no maximum is set. It can be used to set a limit of e.g., 1000 to avoid when starting up the server that there are thousands of files. Set a value of 0 or negative to disable it as unlimited. |
Very often a BatchConsumer
is scheduled and is based of the ScheduledBatchPollingConsumer
that has many options for configuring the scheduling. These options are listed with (scheduler) as label in the endpoint options' in the Components documentation.
Exchange Properties
The following properties are set on the Exchange for each Exchange polled in the same batch.
Property | Description |
---|---|
| The total number of Exchanges that was polled in this batch. |
| The current index of the batch. Starts from 0. |
| A boolean indicating the last Exchange in the batch. Is only |