| // Do not edit directly! |
| // This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page |
| [id="extensions-controlbus"] |
| = Control Bus |
| :page-aliases: extensions/controlbus.adoc |
| :linkattrs: |
| :cq-artifact-id: camel-quarkus-controlbus |
| :cq-native-supported: true |
| :cq-status: Stable |
| :cq-status-deprecation: Stable |
| :cq-description: Manage and monitor Camel routes. |
| :cq-deprecated: false |
| :cq-jvm-since: 0.4.0 |
| :cq-native-since: 0.4.0 |
| |
| ifeval::[{doc-show-badges} == true] |
| [.badges] |
| [.badge-key]##JVM since##[.badge-supported]##0.4.0## [.badge-key]##Native since##[.badge-supported]##0.4.0## |
| endif::[] |
| |
| Manage and monitor Camel routes. |
| |
| [id="extensions-controlbus-whats-inside"] |
| == What's inside |
| |
| * xref:{cq-camel-components}::controlbus-component.adoc[Control Bus component], URI syntax: `controlbus:command:language` |
| |
| Please refer to the above link for usage and configuration details. |
| |
| [id="extensions-controlbus-maven-coordinates"] |
| == Maven coordinates |
| |
| https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-controlbus[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"] |
| |
| Or add the coordinates to your existing project: |
| |
| [source,xml] |
| ---- |
| <dependency> |
| <groupId>org.apache.camel.quarkus</groupId> |
| <artifactId>camel-quarkus-controlbus</artifactId> |
| </dependency> |
| ---- |
| ifeval::[{doc-show-user-guide-link} == true] |
| Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. |
| endif::[] |
| |
| [id="extensions-controlbus-usage"] |
| == Usage |
| ifeval::[{doc-show-advanced-features} == true] |
| [id="extensions-controlbus-usage-statistics"] |
| === Statistics |
| |
| When using the `stats` command endpoint, the `camel-quarkus-management` extension must be added as a project dependency to enable JMX. Maven users will have to add the following to their `pom.xml`: |
| |
| [source,xml] |
| ---- |
| <dependency> |
| <groupId>org.apache.camel.quarkus</groupId> |
| <artifactId>camel-quarkus-management</artifactId> |
| </dependency> |
| ---- |
| endif::[] |
| |
| [id="extensions-controlbus-usage-languages"] |
| === Languages |
| ifeval::[{doc-show-extra-content} == true] |
| include::controlbus-supported-languages.adoc[] |
| endif::[] |
| |
| [id="extensions-controlbus-usage-bean"] |
| ==== Bean |
| |
| The Bean language can be used to invoke a method on a bean to control the state of routes. The `org.apache.camel.quarkus:camel-quarkus-bean` extension must be added to the classpath. Maven users must add the following dependency to the POM: |
| |
| [source,xml] |
| ---- |
| <dependency> |
| <groupId>org.apache.camel.quarkus</groupId> |
| <artifactId>camel-quarkus-bean</artifactId> |
| </dependency> |
| ---- |
| |
| In native mode, the bean class must be annotated with `@RegisterForReflection`. |
| |
| [id="extensions-controlbus-usage-simple"] |
| ==== Simple |
| |
| The Simple language can be used to control the state of routes. The following example uses a `ProducerTemplate` to stop a route with the id `foo`: |
| |
| [source,java] |
| ---- |
| template.sendBody( |
| "controlbus:language:simple", |
| "${camelContext.getRouteController().stopRoute('foo')}" |
| ); |
| ---- |
| |
| To use the OGNL notation, the `org.apache.camel.quarkus:camel-quarkus-bean` extension must be added as a dependency. |
| |
| In native mode, the classes used in the OGNL notation must be registered for reflection. In the above code snippet, the `org.apache.camel.spi.RouteController` class returned from `camelContext.getRouteController()` must be registered. As this is a third-party class, it cannot be annotated with `@RegisterForReflection` directly - instead you can annotate a different class and specifying the target classes to register. For example, the class defining the Camel routes could be annotated with `@RegisterForReflection(targets = { org.apache.camel.spi.RouteController.class })`. |
| |
| Alternatively, add the following line to your `src/main/resources/application.properties`: |
| |
| [source,properties] |
| ---- |
| quarkus.camel.native.reflection.include-patterns = org.apache.camel.spi.RouteController |
| ---- |
| |
| |
| [id="extensions-controlbus-camel-quarkus-limitations"] |
| == Camel Quarkus limitations |
| |
| [id="extensions-controlbus-limitations-statistics"] |
| === Statistics |
| |
| ifeval::[{doc-show-advanced-features} == true] |
| The `stats` action is not available in native mode as JMX is not supported on GraalVM. Therefore, attempting to build a native image with the `camel-quarkus-management` extension on the classpath will result in a build failure. |
| endif::[] |
| |
| ifeval::[{doc-show-extra-content} == true] |
| include::controlbus-statistics-unsupported.adoc[] |
| endif::[] |
| |