| = Batch Consumer |
| |
| Batch Consumer is basically a xref:components:eips:polling-consumer.adoc[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: |
| |
| * xref:components::aws2-ddb-component.adoc[AWS2 DDB] |
| * xref:components::aws2-kinesis-component.adoc[AWS2 Kinesis] |
| * xref:components::aws2-s3-component.adoc[AWS2 S3] |
| * xref:components::aws2-sqs-component.adoc[AWS2 SQS] |
| * xref:components::file-component.adoc[File] |
| * xref:components::ftp-component.adoc[FTP] |
| * xref:components::ironmq-component.adoc[IronMQ] |
| * xref:components::jooq-component.adoc[Jooq] |
| * xref:components::jpa-component.adoc[JPA] |
| * xref:components::mail-component.adoc[Mail] |
| * xref:components::minio-component.adoc[Minio] |
| * xref:components::mybatis-component.adoc[MyBatis] |
| * xref:components::slack-component.adoc[Slack] |
| * xref:components::splunk-component.adoc[Splunk] |
| * xref:components::sql-component.adoc[SQL] |
| |
| == Options |
| |
| The `BatchConsumer` supports the following options: |
| |
| [width="100%",cols="20%,80%",options="header",] |
| |======================================================================= |
| |Option |Description |
| |`maxMessagesPerPoll` |An integer to define a maximum messages to gather per poll. By default, |
| no maximum is set. 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 disabled 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 endpoints options in the xref:components::index.adoc[Components] documentation. |
| |
| == Exchange Properties |
| |
| The following properties is set on the Exchange for |
| each Exchange polled in the same batch. |
| |
| [width="100%",cols="20%,80%",options="header",] |
| |======================================================================= |
| |Property |Description |
| |`CamelBatchSize` |The total number of Exchanges that was polled in this batch. |
| |`CamelBatchIndex` |The current index of the batch. Starts from 0. |
| |`CamelBatchComplete` |A boolean indicating the last Exchange in the batch. |
| Is only `true` for the last entry. |
| |======================================================================= |
| |