gnodet-bot commented on code in PR #31304:
URL: https://github.com/apache/camel/pull/31304#discussion_r4778646326


##########
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:
   šŸ’¬ **Low — edge case: dynamic reset from N→0 leaves stale `maxRows`.**
   
   If `setMaxMessagesPerPoll` is called a first time with `N > 0` (which sets 
`jdbcTemplate.maxRows = N`), and then called again with `0` (the new guard 
skips the `setMaxRows` call), the template retains `maxRows = N` instead of 
reverting to the template-configured value.
   
   This is a niche scenario — `maxMessagesPerPoll` is typically configured once 
at route startup — but it could surprise operators who reconfigure at runtime 
(e.g. via JMX).
   
   Note: simply adding `else { jdbcTemplate.setMaxRows(0); }` would 
re-introduce the original bug (overriding a user-configured `template.maxRows` 
with 0). A correct reset would need to track the template's pre-override 
`maxRows` and restore it, which is likely overkill for this use case. Worth a 
Javadoc note or a comment acknowledging the limitation.



-- 
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]

Reply via email to