You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/11/09 16:50:05 UTC

[GitHub] [camel-quarkus] djcoleman commented on a diff in pull request #4266: controlbus: Added language tests (fixes #4008)

djcoleman commented on code in PR #4266:
URL: https://github.com/apache/camel-quarkus/pull/4266#discussion_r1018185316


##########
docs/modules/ROOT/pages/reference/extensions/controlbus.adoc:
##########
@@ -61,6 +64,61 @@ When using the `stats` command endpoint, the `camel-quarkus-management` extensio
 ----
 
 
+[id="extensions-controlbus-usage-languages"]
+=== Languages
+
+[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` - instead you can the following config file to `src/main/resources/reflection-config.json`:

Review Comment:
   Added `@RegisterForReflection` to the Routes class instead, but documented both those approaches, and got rid of the additional config class, which was a much more convoluted way of doing it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org