Skip to content

CAMEL-24196: camel-aws2-sqs - Fix QueueDoesNotExist swallowed, thread pool leak, and batch chunking#24873

Merged
davsclaus merged 1 commit into
mainfrom
fix/CAMEL-24196
Jul 17, 2026
Merged

CAMEL-24196: camel-aws2-sqs - Fix QueueDoesNotExist swallowed, thread pool leak, and batch chunking#24873
davsclaus merged 1 commit into
mainfrom
fix/CAMEL-24196

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Summary

Claude Code on behalf of davsclaus

Fixes three bugs in camel-aws2-sqs:

  • QueueDoesNotExistException silently swallowed (Sqs2Consumer): When maxMessagesPerPoll > 10, parallel polling sends N requests. Only the first thread to catch QueueDoesNotExistException fires an error (errorCount=1), but the error propagation check requires errorCount == N, which never matches. Fix: added explicit check for isQueueMissing() && hasErrors() before the all-errors check.

  • Thread pool leak on stop/start (Sqs2Consumer): doStart() unconditionally creates a new PollingTask with a new thread pool, but cleanup only happened in doShutdown(), not doStop(). Each route stop/start cycle leaked the previous thread pool. Fix: added doStop() override that cleans up the PollingTask, TimeoutExtender, and scheduled executor.

  • sendBatchMessage missing 10-entry chunking (Sqs2Producer): All entries were collected into a single sendMessageBatch() call. SQS hard-limits batches to 10 entries; 11+ throws TooManyEntriesInBatchRequestException. Fix: extracted sendBatchEntries() helper that chunks entries into groups of 10.

Test plan

  • Module builds successfully (mvn install -DskipTests)
  • Existing integration tests still pass
  • Bug 1 verified by code inspection — queue-missing error now propagated regardless of parallel request count
  • Bug 2 verified by code inspection — doStop() cleans up all resources that doStart() creates
  • Bug 3 verified by code inspection — entries chunked into groups of 10 before SQS API call

🤖 Generated with Claude Code

… pool leak, and batch chunking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@davsclaus
davsclaus requested review from orpiske and oscerd July 17, 2026 19:01
@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.

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code on behalf of gnodet

CAMEL-24196: camel-aws2-sqs — three well-scoped fixes — LGTM

1. QueueDoesNotExistException silently swallowed ✅

Good catch. When maxMessagesPerPoll > 10, the parallel polling sends N requests but the existing errorCount == numberOfRequestsPerPoll check fails when only a subset of threads register the error (e.g., errorCount == 1 but N > 1). The new isQueueMissing() && hasErrors() check short-circuits before that, correctly surfacing the queue-missing error regardless of how many parallel requests were sent.

2. Thread pool leak on stop/start ✅

Proper lifecycle fix. doStop() mirrors doShutdown() with two correct differences:

  • doStop() calls super.doStop() first (top-down), doShutdown() calls super.doShutdown() last (bottom-up) — standard Camel lifecycle pattern
  • doStop() uses graceful shutdown(), doShutdown() uses shutdownNow() — correct escalation semantics

Since doStop() nulls all references, doShutdown() safely skips (idempotent).

3. sendBatchMessage 10-entry chunking ✅

Fixes the hard SQS limit violation (TooManyEntriesInBatchRequestException on >10 entries). Clean extraction into sendBatchEntries(). The totalFailed/totalSuccessful aggregation across chunks is correct.

Note: message.setBody(lastResult) only captures the final chunk's SendMessageBatchResponse. For ≤10 entries (the only case that worked before), behavior is identical. For >10 entries (previously broken), callers who need per-entry results would need to rely on the aggregate headers rather than the body. This is a reasonable tradeoff for a fix that makes >10 entries work at all — just worth documenting if users ask.

Also nice cleanup: IterableIterable<?> removes the raw type warning.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-aws/camel-aws2-sqs

🔬 Scalpel shadow comparison — Scalpel: 10 tested, 29 compile-only — current: 10 all tested

Maveniverse Scalpel detected 39 affected modules (current approach: 10).

⚠️ Modules only in Scalpel (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 10 modules (1 direct + 9 downstream), skip tests for 29 (generated code, meta-modules)

Modules Scalpel would test (10)
  • camel-aws2-eventbridge
  • camel-aws2-sqs
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules with tests skipped (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (39 modules)
  • Camel :: AWS2 Eventbridge
  • Camel :: AWS2 SQS
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: CSimple Maven Plugin (deprecated)
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Lucene (deprecated)
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@davsclaus davsclaus added this to the 4.22.0 milestone Jul 17, 2026
@davsclaus davsclaus added the bug Something isn't working label Jul 17, 2026
@davsclaus davsclaus self-assigned this Jul 17, 2026
@davsclaus
davsclaus merged commit dd1d7ca into main Jul 17, 2026
5 checks passed
@davsclaus
davsclaus deleted the fix/CAMEL-24196 branch July 17, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working components components-aws

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants