gnodet commented on PR #22159: URL: https://github.com/apache/camel/pull/22159#issuecomment-4143822445
Good question @Croway. The bulk component doesn't directly integrate with the `transacted()` EIP — this is by design, similar to how the Splitter EIP doesn't wrap all splits in a single transaction. Here's how it works: - Each item is processed individually via the configured processor endpoint. Exceptions are caught internally for failure tracking (error thresholds, `BulkResult` statistics), so Camel's route-level error handling / transaction rollback doesn't apply to individual item failures. - **Per-item transactions**: If the processor endpoint route uses `transacted()`, each item will be processed in its own transaction — commit on success, rollback on failure. This is probably the most common use case. - **Bulk-level transactions**: There's no built-in way to wrap all items in a single transaction, since that would conflict with the chunking/partial-failure model (the whole point is to allow some items to fail while others succeed). If you need all-or-nothing semantics, you could use `aggregationStrategy` to collect results and commit them in a subsequent step, or set `errorThreshold=0.0` to abort on first failure and let the caller handle rollback. This is consistent with how other Camel components handle similar patterns — e.g., the Splitter EIP processes splits independently, and batch consumers (file, JPA, etc.) process messages individually with their own unit of work. Should we document this explicitly in the component docs? Happy to add a section on transaction interaction. _Claude Code on behalf of Guillaume Nodet_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
