Jolokia
JVM since3.19.0 Nativeunsupported
Expose runtime metrics and management operations via JMX with Jolokia
Maven coordinates
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jolokia</artifactId>
</dependency>
Check the User guide for more information about writing Camel Quarkus applications.
Usage
This extension adds Jolokia support to your application.
Jolokia HTTP endpoints
In prod mode, Jolokia is accessible at the following URLs.
In dev and test modes Jolokia is bound only to localhost
.
To disable exposing Jolokia via the Quarkus management interface at /q/jolokia
, add the following configuration to application.properties
.
quarkus.camel.jolokia.register-management-endpoint=false
If you want to disable Jolokia entirely, then add the following configuration to application.properties
.
quarkus.camel.jolokia.enabled=false
Jolokia configuration
Any of the Jolokia configuration options can be configured via the quarkus.camel.jolokia.additional-properties.<jolokia-property-name>
option. Where <jolokia-property-name>
is the name of the Jolokia configuration option you want to set.
For example, the following configuration added to application.properties
enables Jolokia debugging and sets the max depth for traversing bean properties.
quarkus.camel.jolokia.additional-properties.debug=true
quarkus.camel.jolokia.additional-properties.maxDepth=10
Jolokia restrictor
By default, a Jolokia restrictor is automatically registered that exposes access to only a specific set of MBean domains.
-
org.apache.camel
-
java.lang
-
java.nio
If this is too restrictive, then you can either disable the default restrictor, or create your own custom restrictor.
Disable the default restrictor
The following configuration added to application.properties
disables the default restrictor.
quarkus.camel.jolokia.register-camel-restrictor=false
Create a custom restrictor
You can create your own restrictor class and register it with Jolokia.
public class CustomRestrictor extends AllowAllRestrictor {
// Override methods to apply custom restrictions
}
Register the restrictor with Jolokia by adding the following configuration to application.properties
.
quarkus.camel.jolokia.additional-properties.restrictorClass=org.acme.CustomRestrictor
Kubernetes & OpenShift support
Generated Kubernetes manifests
If the quarkus-kubernetes
or quarkus-openshift
extensions are present, a container port named jolokia
will be added automatically to the pod configuration within the generated Kubernetes manifest resources.
This can be disabled by adding the following configuration to application.properties
.
quarkus.camel.jolokia.kubernetes.expose-container-port=false
Automatic enablement of SSL client authentication
If the application detects that it is running on Kubernetes or OpenShift, then Jolokia is automatically configured for SSL client authentication. This is useful if you use tools like Hawtio to discover and connect to your running application pod.
This functionality can be disabled by adding the following configuration to application.properties
.
quarkus.camel.jolokia.kubernetes.client-authentication-enabled=false
Note that if you choose to use hawtio-online to connect to your running application, then you must configure the Jolokia client principal.
quarkus.camel.jolokia.kubernetes.client-principal="cn=hawtio-online.hawtio.svc"
Additional Camel Quarkus configuration
Configuration property | Type | Default |
---|---|---|
Enables Jolokia support. |
|
|
The context path that the Jolokia agent is deployed under. |
|
|
Whether to register a Quarkus management endpoint for Jolokia (default /q/jolokia). When enabled this activates a management endpoint which will be accessible on a path relative to ${quarkus.http.non-application-root-path}/${quarkus.camel.jolokia.server.path}. If the management interface is enabled, the value will be resolved as a path relative to ${quarkus.management.root-path}/${quarkus.camel.jolokia.server.path}. Note that for this feature to work you must have quarkus-vertx-http on the application classpath. |
|
|
When {@code true} and the quarkus-kubernetes extension is present, a container port named jolokia will be added to the generated Kubernetes manifests within the container spec ports definition. |
|
|
Whether the Jolokia agent HTTP server should be started automatically. When set to {@code false}, it is the user responsibility to start the server. This can be done via {@code @Inject CamelQuarkusJolokiaServer} and then invoking the start() method. |
|
|
The host address to which the Jolokia agent HTTP server should bind to. When unspecified, the default is localhost for dev and test mode. In prod mode the default is to bind to all interfaces at 0.0.0.0. |
| |
The port on which the Jolokia agent HTTP server should listen on. |
|
|
The mode in which Jolokia agent discovery is enabled. The default {@code dev-test}, enables discovery only in dev and test modes. A value of {@code all} enables agent discovery in dev, test and prod modes. Setting the value to {@code none} will disable agent discovery in all modes. |
|
|
Whether to enable Jolokia SSL client authentication in Kubernetes environments. Useful for tools such as hawtio to be able to connect with your application. |
|
|
Absolute path of the CA certificate Jolokia should use for SSL client authentication. |
| |
The principal which must be given in a client certificate to allow access to Jolokia. |
| |
Arbitrary Jolokia configuration options. These are described at the <a href="https://jolokia.org/reference/html/manual/agents.html">Jolokia documentation</a>. Options can be configured like {@code quarkus.camel.jolokia.additional-properties."debug"=true}. |
| |
When {@code true}, a Jolokia restrictor is registered that limits MBean read, write and operation execution to the following MBean domains. <ul> <li>org.apache.camel</li> <li>java.lang</li> <li>java.nio</li> </ul> Note that this option has no effect if quarkus.camel.jolokia.additional-properties."restrictorClass" is set. |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.