ammachado commented on code in PR #31304:
URL: https://github.com/apache/camel/pull/31304#discussion_r4778903425
##########
components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlConsumer.java:
##########
@@ -459,7 +459,8 @@ public void setBreakBatchOnConsumeFail(boolean
breakBatchOnConsumeFail) {
public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
super.setMaxMessagesPerPoll(maxMessagesPerPoll);
- if (jdbcTemplate != null) {
+ // 0 means no limit: keep the maxRows of the template
(template.maxRows)
+ if (jdbcTemplate != null && maxMessagesPerPoll > 0) {
Review Comment:
Fixed in the behavior rather than documented, in 4db8b06aa518: the consumer
now remembers the template's own `maxRows` (from `template.maxRows`) when it is
created, and `setMaxMessagesPerPoll(0)` restores it instead of keeping the
previous N.
`SqlConsumerTemplateMaxRowsTest#resetMaxMessagesPerPollRestoresTemplateMaxRows`
covers N then 0 (and fails on the previous code with `expected: <2> but was:
<5>`). For the record, `maxMessagesPerPoll` is not exposed through JMX, so this
was only reachable by calling the setter from Java.
_Claude Code on behalf of Adriano Machado (@ammachado)_
_This was generated by an AI agent and may contain inaccuracies. Please
verify before relying on it._
--
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]