2.17. 控制总线
管理和监控 Camel 路由。
2.17.1. 内部 复制链接链接已复制到粘贴板!
- 
							
控制总线组件,URI 语法:controlbus:command:language 
有关用法和配置详情,请参阅上面的链接。
2.17.2. Maven 协调 复制链接链接已复制到粘贴板!
在 code.quarkus.redhat.com 上使用此扩展创建一个新项目
或者在现有项目中添加协调:
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-controlbus</artifactId>
</dependency>
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-controlbus</artifactId>
</dependency>
2.17.3. 使用 复制链接链接已复制到粘贴板!
2.17.3.1. 语言 复制链接链接已复制到粘贴板!
在 Camel Extensions for Quarkus 中的 Control Bus 扩展中支持以下语言:
2.17.3.1.1. bean 复制链接链接已复制到粘贴板!
							Bean 语言可用于调用 bean 的方法来控制路由的状态。org.apache.camel.quarkus:camel-quarkus-bean 扩展必须添加到 classpath 中。Maven 用户必须在 POM 中添加以下依赖项:
						
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-bean</artifactId>
</dependency>
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-bean</artifactId>
</dependency>
							在原生模式中,Bean 类必须使用 @RegisterForReflection 注解。
						
2.17.3.1.2. Simple(简单) 复制链接链接已复制到粘贴板!
							Simple 语言可用于控制路由的状态。以下示例使用 ProducerTemplate 来停止 ID 为 foo 的路由:
						
template.sendBody(
    "controlbus:language:simple",
    "${camelContext.getRouteController().stopRoute('foo')}"
);
template.sendBody(
    "controlbus:language:simple",
    "${camelContext.getRouteController().stopRoute('foo')}"
);
							要使用 OGNL 表示法,必须将 org.apache.camel.quarkus:camel-quarkus-bean 扩展添加为依赖项。
						
							在原生模式中,必须注册 OGNL 标记中使用的类来反映。在上面的代码片段中,必须注册从 camelContext.getRouteController () 返回的 org.apache.camel.spi.RouteController 类。由于这是一个第三方类,它不能直接使用 @RegisterForReflection 进行注释 - 相反,您可以注解不同的类并指定要注册的目标类。例如,定义 Camel 路由的类可以使用 @RegisterForReflection (targets = { org.apache.camel.spi.RouteController.class }) 进行注解。
						
							或者,在 src/main/resources/application.properties 中添加以下行:
						
quarkus.camel.native.reflection.include-patterns = org.apache.camel.spi.RouteController
quarkus.camel.native.reflection.include-patterns = org.apache.camel.spi.RouteController
2.17.4. Camel Quarkus 限制 复制链接链接已复制到粘贴板!
2.17.4.1. Statistics 复制链接链接已复制到粘贴板!
Camel Extensions for Quarkus 不支持此功能。