You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2025/03/07 11:17:39 UTC

(camel-quarkus-examples) 01/03: Add Jolokia extension to observability example project

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch camel-quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git

commit 5f9d5e4b2c65b4d52ce56483b5b54244c0f8fa36
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri Mar 7 07:50:15 2025 +0000

    Add Jolokia extension to observability example project
---
 observability/README.adoc                          | 24 ++++++++++++++++++++++
 observability/pom.xml                              |  4 ++++
 .../src/main/resources/application.properties      |  3 +++
 3 files changed, 31 insertions(+)

diff --git a/observability/README.adoc b/observability/README.adoc
index 1d009a3..4f9769b 100644
--- a/observability/README.adoc
+++ b/observability/README.adoc
@@ -168,6 +168,30 @@ With the server running, browse to http://localhost:16686. Then choose 'camel-qu
 The `platform-http` consumer route introduces a random delay to simulate latency, hence the overall time of each trace should be different. When viewing a trace, you should see
 a hierarchy of 6 spans showing the progression of the message exchange through each endpoint.
 
+=== Jolokia & Hawtio
+
+It can be useful to leverage Camel's JMX management features to manage and introspect the application.
+
+You can interact with the https://jolokia.org[Jolokia] endpoint using cURL. For example to fetch information about the `CamelContext`.
+
+[source,shell]
+----
+$ curl -s 'http://localhost:8778/jolokia/read/org.apache.camel:context=*,type=context,name=*' | jq
+----
+
+https://hawt.io/[Hawtio] can be used to visualize your Camel routes. https://www.jbang.dev/[JBang] is a convenient way to get started.
+
+[source,shell]
+----
+$ jbang app install hawtio@hawtio/hawtio
+$ hawtio --port 8085
+----
+
+When this example project is run in dev mode, it will be discoverable from Hawtio via the 'Discover' tab.
+When running the application from the runnable JAR or native binary, you'll need to choose 'Add Connection' from the 'Remote' tab and add a connection for http://localhost:8778/jolokia/.
+
+When deploying to Kubernetes or Openshift, you can use https://github.com/hawtio/hawtio-online[Hawtio Online]. The `camel-quarkus-jolokia` extension will automatically configure the application to be discoverable from the Hawtio Online console.
+
 === Package and run the application
 
 Once you are done with developing you may want to package and run the application.
diff --git a/observability/pom.xml b/observability/pom.xml
index 8460027..f847ecd 100644
--- a/observability/pom.xml
+++ b/observability/pom.xml
@@ -94,6 +94,10 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-observability-services</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-jolokia</artifactId>
+        </dependency>
         <dependency>
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-resteasy</artifactId>
diff --git a/observability/src/main/resources/application.properties b/observability/src/main/resources/application.properties
index 6b619b2..f48ea78 100644
--- a/observability/src/main/resources/application.properties
+++ b/observability/src/main/resources/application.properties
@@ -41,3 +41,6 @@ greeting-app.service.port = ${CAMEL_QUARKUS_OBSERVABILITY_SERVICE_PORT_HTTP:${qu
 greeting-provider-app.service.host = localhost
 greeting-provider-app.service.port = ${quarkus.http.port}
 %test.greeting-provider-app.service.port = ${quarkus.http.test-port}
+
+# Optional hawtio-online support
+quarkus.camel.jolokia.kubernetes.client-principal=cn=hawtio-online.hawtio.svc