Skip to content

CAMEL-24159: camel-azure-storage-queue - Fix medium-severity bugs from code review#24870

Merged
davsclaus merged 2 commits into
mainfrom
fix/CAMEL-24159-queue
Jul 18, 2026
Merged

CAMEL-24159: camel-azure-storage-queue - Fix medium-severity bugs from code review#24870
davsclaus merged 2 commits into
mainfrom
fix/CAMEL-24159-queue

Conversation

@davsclaus

@davsclaus davsclaus commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Claude Code on behalf of davsclaus

Fixes 2 medium-severity findings in camel-azure-storage-queue from CAMEL-24159 code review:

  • Credential override guard (QueueComponent): wrap the else branch with if (credentialType == null) so user-explicit credential type is not overridden when a StorageSharedKeyCredential bean is found in the registry.
  • Idempotent queue creation (QueueOperations + QueueClientWrapper): when createQueue=true on sendMessage, use createIfNotExistsWithResponse() instead of create() so repeated sends don't throw HTTP 409 Conflict when the queue already exists with different metadata.

Review feedback addressed

  • Fixed createIfNotExists wrapper to forward metadata and timeout via createIfNotExistsWithResponse(metadata, timeout, Context.NONE) instead of the no-arg createIfNotExists() that silently dropped both parameters.

Test plan

  • Module builds successfully: cd components/camel-azure/camel-azure-storage-queue && mvn clean install
  • Verify credential override guard preserves user-explicit credentialType
  • Verify sendMessage with createQueue=true succeeds on second call when queue already exists

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

…m code review

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@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

The credential override guard is correct (same pattern as the other azure PRs). The createIfNotExists fix addresses a real usability issue.

Credential override guard (QueueComponent.java)

Consistent with servicebus/eventhubs/blob PRs. if (credentialType == null) prevents overriding explicit user configuration. ✅

Idempotent queue creation (QueueOperations + QueueClientWrapper)

The switch from create() (throws 409 on existing queue) to createIfNotExists() is the right fix for the createQueue=true use case — producers shouldn't fail on repeated sends.

However, the wrapper method silently drops its parameters:

public void createIfNotExists(Map<String, String> metadata, Duration timeout) {
    client.createIfNotExists();  // ← metadata and timeout are ignored!
}

The calling code in QueueOperations extracts metadata and timeout from the exchange and passes them in, but they're never forwarded. This is a regression compared to the old create(metadata, timeout) call — users who set queue metadata via exchange headers would silently lose that metadata.

The Azure SDK's QueueClient has createIfNotExistsWithResponse(Map<String, String> metadata, Duration timeout, Context context) — the implementation should be:

public void createIfNotExists(Map<String, String> metadata, Duration timeout) {
    client.createIfNotExistsWithResponse(metadata, timeout, Context.NONE);
}

This should be a small fix. Everything else LGTM.

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-azure/camel-azure-storage-queue

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

Maveniverse Scalpel detected 38 affected modules (current approach: 9).

⚠️ 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 9 modules (1 direct + 8 downstream), skip tests for 29 (generated code, meta-modules)

Modules Scalpel would test (9)
  • camel-azure-storage-queue
  • 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 (38 modules)
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Azure :: Storage Queue
  • 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

…eateIfNotExists

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@davsclaus

Copy link
Copy Markdown
Contributor Author

Claude Code on behalf of davsclaus

@gnodet Good catch — fixed in 1aacea0. The wrapper now calls client.createIfNotExistsWithResponse(metadata, timeout, Context.NONE), matching the pattern used by the existing create() method directly above it.

@davsclaus
davsclaus requested a review from gnodet July 17, 2026 21:00

@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 review on behalf of gnodet

Re-review — commit 1aacea0

The `createIfNotExists` parameter-dropping bug I flagged is now fixed:

// Before: ignored metadata and timeout
client.createIfNotExists();

// After: forwards both parameters
client.createIfNotExistsWithResponse(metadata, timeout, Context.NONE);

This was the last outstanding item. LGTM.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants