3.3. XML IO DSL
XML で Camel ルート、rests、またはテンプレートを設定するには、Camel XML パーサーの依存関係をクラスパスに追加する必要があります。Camel Quarkus 1.8.0 以降、https://access.redhat.com/documentation/ja-jp/red_hat_build_of_apache_camel/4.4/html-single/red_hat_build_of_apache_camel_for_quarkus_reference/ #extensions-xml-io-dsl[camel-quarkus-xml-io-dsl] が最適な選択肢です。
Camel Main では、ルート、REST DSL、ルートテンプレート などのリソース XML ファイルの場所を指すプロパティーを設定できます。
camel.main.routes-include-pattern = routes/routes.xml, file:src/main/routes/rests.xml, file:src/main/rests/route-template.xml
camel.main.routes-include-pattern = *./routes.xml のようなパスグロビングは、現在ネイティブモードでは機能しません。
ルート
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<route id="xml-route">
<from uri="timer:from-xml?period=1000"/>
<log message="Hello XML!"/>
</route>
</routes>
Bean で XML ルートを使用する場合は、beanType=org.apache.SomeClass のようにクラス名を参照する必要があります。このような場合には、リフレクションのためにクラスをネイティブモードで登録する必要がある場合があります。詳細は、ネイティブモード のセクションを参照してください。
< blueprint> 要素のある はサポートされていません。
<beans > または Blueprint XML を持つ Spring XML
ルート XML は、次のように簡素化されたバージョンである必要があります。
REST DSL
<rests xmlns="http://camel.apache.org/schema/spring">
<rest id="greeting" path="/greeting">
<get path="/hello">
<to uri="direct:greet"/>
</get>
</rest>
</rests>
ルートテンプレート
<routeTemplates xmlns="http://camel.apache.org/schema/spring">
<routeTemplate id="myTemplate">
<templateParameter name="name"/>
<templateParameter name="greeting"/>
<templateParameter name="myPeriod" defaultValue="3s"/>
<route>
<from uri="timer:{{name}}?period={{myPeriod}}"/>
<setBody><simple>{{greeting}} ${body}</simple></setBody>
<log message="${body}"/>
</route>
</routeTemplate>
</routeTemplates>