Skip to content

Camel 23523 kafka batch interval reset#23248

Merged
davsclaus merged 2 commits into
apache:mainfrom
FNaughton:CAMEL-23523-kafka-batch-interval-reset
May 15, 2026
Merged

Camel 23523 kafka batch interval reset#23248
davsclaus merged 2 commits into
apache:mainfrom
FNaughton:CAMEL-23523-kafka-batch-interval-reset

Conversation

@FNaughton
Copy link
Copy Markdown
Contributor

@FNaughton FNaughton commented May 15, 2026

Description

Summary

  • Fixes a bug where intervalWatch is never reset when exchangeList transitions
    from empty to non-empty, unlike timeoutWatch which is reset at that point.
  • After an idle period longer than batchingIntervalMs, the watch is pre-expired,
    causing hasExpiredRecords() to fire on the very next poll that returns records,
    flushing a prematurely small batch.
  • Fix: add intervalWatch.restart() alongside timeoutWatch.takenAndRestart() in
    the exchangeList.isEmpty() branch of processExchange().

Test plan

  • New IT KafkaBatchingIntervalResetAfterIdleIT fails on unfixed code and
    passes after the fix
  • All five pre-existing batching ITs pass unchanged

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-kafka

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • components/camel-kafka: 2 test(s) disabled on GitHub Actions
All tested modules (8 modules)
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kafka
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@FNaughton FNaughton marked this pull request as ready for review May 15, 2026 12:36
@davsclaus davsclaus merged commit c1b833d into apache:main May 15, 2026
6 checks passed
davsclaus added a commit that referenced this pull request May 15, 2026
* CAMEL-23523: Reset intervalWatch when batch accumulation begins to prevent premature flush after idle

* CAMEL-23523: Improve KafkaBatchingIntervalResetAfterIdleIT timing mechanics

---------

Co-authored-by: FNaughton <finbarrnaughton@gmail.com>
Co-authored-by: Finbarr Naughton <finbarr.naughton@workhuman.com>
davsclaus added a commit that referenced this pull request May 15, 2026
* CAMEL-23523: Reset intervalWatch when batch accumulation begins to prevent premature flush after idle

* CAMEL-23523: Improve KafkaBatchingIntervalResetAfterIdleIT timing mechanics

---------

Co-authored-by: FNaughton <finbarrnaughton@gmail.com>
Co-authored-by: Finbarr Naughton <finbarr.naughton@workhuman.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants