Skip to content

Add AMQ Broker and Keycloak integration example#511

Open
JinyuChen97 wants to merge 1 commit into
apache:camel-quarkus-mainfrom
JinyuChen97:CEQ-9957
Open

Add AMQ Broker and Keycloak integration example#511
JinyuChen97 wants to merge 1 commit into
apache:camel-quarkus-mainfrom
JinyuChen97:CEQ-9957

Conversation

@JinyuChen97

@JinyuChen97 JinyuChen97 commented May 29, 2026

Copy link
Copy Markdown

This example demonstrates integration of Apache ActiveMQ Artemis (AMQ Broker) with Keycloak authentication in a Camel Quarkus application.

Features:

  • REST endpoint for order submission with Keycloak authentication
  • SOAP endpoint for inventory management with Keycloak security policy
  • JMS integration using AMQ Broker for asynchronous order processing
  • Admin endpoint with role-based access control (RBAC)
  • Keycloak component for user management

The example supports:

  • Development mode with Dev Services (auto-start Keycloak and Artemis)
  • JVM mode
  • Native mode
  • Kubernetes deployment with complete YAML manifests and testing guide

@aldettinger

aldettinger commented May 29, 2026

Copy link
Copy Markdown
Contributor

The platform version should probably be upgraded after the recent release of the camel-quarkus main branch:

Caused by: org.apache.maven.plugin.MojoFailureException: Found 5 consistency issues:
 - Expected <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>, found io.quarkus.platform in ./amq-broker-keycloak/pom.xml
 - Expected <quarkus.platform.version>3.36.0</quarkus.platform.version>, found 3.35.1 in ./amq-broker-keycloak/pom.xml
 - Expected <camel-quarkus.platform.group-id>org.apache.camel.quarkus</camel-quarkus.platform.group-id>, found ${quarkus.platform.group-id} in ./amq-broker-keycloak/pom.xml
 - Expected <camel-quarkus.platform.artifact-id>camel-quarkus-bom</camel-quarkus.platform.artifact-id>, found quarkus-camel-bom in ./amq-broker-keycloak/pom.xml
 - Expected <camel-quarkus.platform.version>3.37.0-SNAPSHOT</camel-quarkus.platform.version>, found ${quarkus.platform.version} in ./amq-broker-keycloak/pom.xml

You may want to run mvn org.l2x6.cq:cq-maven-plugin:2.10.0:examples-set-platform -Dcq.camel-quarkus.version=3.37.0-SNAPSHOT

@JinyuChen97 JinyuChen97 force-pushed the CEQ-9957 branch 2 times, most recently from 0906ed2 to e322d40 Compare May 30, 2026 10:02
Comment thread amq-broker-keycloak/pom.xml Outdated
Comment thread amq-broker-keycloak/README.adoc Outdated
@aldettinger

Copy link
Copy Markdown
Contributor

Looks a great start, generally speaking, there is a question whether the example could be less verbose ? Like do we really need equals method ? Do we really need that much properties in domain pojos ?

The ideal situation would be that each new lines introduced serves the demo purpose as much as possible. So that, users learning camel are not lost into details and complexities that could live in their own example documetation...

Does it make sense ? it's open for discussion for sure :)

%test.soap.inventory.client.address=http://localhost:8081/services/inventory

# Native Configuration
quarkus.native.additional-build-args=--initialize-at-run-time=org.springframework.jms.listener.AbstractMessageListenerContainer$ObservationFactory

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.

Is this definitely needed? If so we need to investigate why.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

you mean the quarkus.native.additional-build-args=--initialize-at-run-time=org.springframework.jms.listener.AbstractMessageListenerContainer$ObservationFactory?
yes, it is needed when I ran the native test, it throwed the following error:
Error: Class initialization of org.springframework.jms.listener.AbstractMessageListenerContainer$ObservationFactory failed caused by: java.lang.ClassNotFoundException: io.micrometer.jakarta9.instrument.jms.JmsProcessObservationConvention, do we need to fix this in camel quarkus?

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.

do we need to fix this in camel quarkus?

Would be good to understand why the issue happens in this example and why we don't see it in the JMS integration tests run in the main Camel Quarkus project

If it turns out to be a pain to fix / investigate, then we can just open an issue in the Camel Quarkus project and then link to it here via a TODO comment in application.properties.

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.

Hmm, it looks like an issue to work with micrometer and can you find the dependencies at the runtime and maybe we can disable it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

After investigation by using quarkus.native.additional-build-args=-H:+PrintClassInitialization, This issue seems triggered by the cxf-soap + jms combination in native mode. During native image build, Quarkus's JaxbProcessor scans @XmlRootElement annotations on Camel route definitions. because of CXF is there, this creates a deep reference chain: CxfEndpoint → JmsEndpoint → AbstractMessageListenerContainer → ObservationFactory (inner class). GraalVM then initializes ObservationFactory at build-time, execute it's static block which requires DefaultJmsProcessObservationConvention from micrometer-jakarta9.

JMS integration tests don't have this issue because they don't use CXF. Without CXF, the scanning is shallow and ObservationFactory is not included. I also verified this by adding cxf-soap dependency to the jms-jpa example, and it reproduced the same error. Please correct if im wrong. and also Is this kind of issue caused by combination need to be fixed in camel quarkus project? or need to mentioned somewhere?

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.

Ok - I actually thought we fixed those kinds of issue.

The acceptable workaround for now will be to add camel-quarkus-jaxb to the project and I'll think of a better solution for the Camel Quarkus core project for the future.

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.

So, have we applied the workaround ? The camel-quarkus-jaxb dependency seems not present in pom.xml ?

@jamesnetherton jamesnetherton changed the title [CEQ-9957]Add AMQ Broker and Keycloak integration example Add AMQ Broker and Keycloak integration example Jun 1, 2026
@JinyuChen97

Copy link
Copy Markdown
Author

Looks a great start, generally speaking, there is a question whether the example could be less verbose ? Like do we really need equals method ? Do we really need that much properties in domain pojos ?

The ideal situation would be that each new lines introduced serves the demo purpose as much as possible. So that, users learning camel are not lost into details and complexities that could live in their own example documetation...

Does it make sense ? it's open for discussion for sure :)

thanks for the advice! I have simplify some domain objects, processor... Currently waiting for the feedback from Ivo or Torsten to see if this REST -> SOAP example is fine.

@jamesnetherton

Copy link
Copy Markdown
Contributor

Heads up that some versions across all other projects have been updated:

  • Quarkus platform - 3.36.1
  • Quarkus artemis - 3.14.3
  • Surefire / Failsafe - 3.5.6

Please ensure this project is updated to be in sync.

This example demonstrates integration of Apache ActiveMQ Artemis (AMQ Broker)
with Keycloak authentication in a Camel Quarkus application.

Features:
- REST endpoint for order submission with Keycloak authentication
- SOAP endpoint for inventory management with Keycloak security policy
- JMS integration using AMQ Broker for asynchronous order processing
- Admin endpoint with role-based access control (RBAC)
- Keycloak component for user management

The example supports:
- Development mode with Dev Services (auto-start Keycloak and Artemis)
- JVM mode
- Native mode
- Kubernetes deployment with complete YAML manifests and testing guide

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
On-Behalf-Of: Jinyu Chen <as0830428946@gmail.com>
@JinyuChen97

Copy link
Copy Markdown
Author

After discussed with Torsten, the example is changed to REST endpoint calls SOAP service synchronously and returns response to client. The order events are asynchronously sent to JMS topic that listen by multiple consumer process events: audit logging, email notification, cache.

@aldettinger

Copy link
Copy Markdown
Contributor

Ok, a last thing following the route design. Would the name amq-broker-keycloak be what users expect ?
Maybe we could name by keywords ala rest-keycloak-soap-jms ? What do you think ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants