17.3. Usage
17.3.1. 統計 リンクのコピーリンクがクリップボードにコピーされました!
stats コマンドエンドポイントを使用する場合は、JMX を有効にするために、camel-quarkus-management エクステンションをプロジェクトの依存関係として追加する必要があります。Maven ユーザーは、pom.xml に以下を追加する必要があります。
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-management</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-management</artifactId>
</dependency>
17.3.2. 言語 リンクのコピーリンクがクリップボードにコピーされました!
次の言語は、Camel Extensions for Quarkus の Control Bus 拡張機能での使用がサポートされています。
17.3.2.1. Bean リンクのコピーリンクがクリップボードにコピーされました!
Bean 言語を使用して、Bean でメソッドを呼び出し、ルートの状態を制御できます。org.apache.camel.quarkus:camel-quarkus-bean エクステンションをクラスパスに追加する必要があります。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 のアノテーションを付ける必要があります。
17.3.2.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