[
https://issues.apache.org/jira/browse/CAMEL-27169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27169 started by shashank.
----------------------------------------
> camel-sql - onConsumeBatchComplete runs after a batch that a stopping
> consumer cut short, so it updates or deletes the rows that were not routed
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27169
> URL: https://issues.apache.org/jira/browse/CAMEL-27169
> Project: Camel
> Issue Type: Bug
> Components: camel-sql
> Reporter: shashank
> Assignee: shashank
> Priority: Major
>
> h3. What happens
> The {{onConsumeBatchComplete}} query is documented to run "after processing
> the entire batch" (for example {{delete from projects}}, as in
> {{SqlConsumerDeleteBatchCompleteTest}}, or an update that marks the rows as
> processed). When the consumer is stopped while it routes a batch (a route
> stop, a context shutdown, a reload: by default the graceful shutdown
> completes only the current exchange), {{SqlConsumer.processBatch}} leaves the
> loop at {{isBatchAllowed()}} and then still runs the query. The rows of the
> batch that were not routed are deleted or marked as processed, and are never
> consumed: they are lost, with no error.
> h3. How to reproduce
> {{SqlConsumerBatchCompleteStopTest}} (camel-sql, embedded H2, three rows):
> the route is stopped while it routes the first row of the batch. On main the
> two rows that were not routed are deleted by {{onConsumeBatchComplete=delete
> from projects}}.
> h3. Fix
> The consumer does not run the {{onConsumeBatchComplete}} query when it routed
> only part of the batch (logged at INFO), and releases the exchanges of the
> rows it did not route.
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)