182.3. Spring XML を使用した Kestrel コンポーネントの設定
明示的な設定の最も単純な形式は以下のとおりです。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="kestrel" class="org.apache.camel.component.kestrel.KestrelComponent"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
</camelContext>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="kestrel" class="org.apache.camel.component.kestrel.KestrelComponent"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
</camelContext>
</beans>
これにより、すべてのデフォルト設定で Kestrel コンポーネントが有効になります。つまり、デフォルトで localhost:22133、100ms の待機時間、および同時でないコンシューマーを 1 つ使用します。
ベース設定で特定のオプションを使用するには( ?properties が指定されていないエンドポイントに設定を提供する)、KestrelConfiguration POJO を以下のように設定します。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="kestrelConfiguration" class="org.apache.camel.component.kestrel.KestrelConfiguration">
<property name="addresses" value="kestrel01:22133"/>
<property name="waitTimeMs" value="100"/>
<property name="concurrentConsumers" value="1"/>
</bean>
<bean id="kestrel" class="org.apache.camel.component.kestrel.KestrelComponent">
<property name="configuration" ref="kestrelConfiguration"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">
</camelContext>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="kestrelConfiguration" class="org.apache.camel.component.kestrel.KestrelConfiguration">
<property name="addresses" value="kestrel01:22133"/>
<property name="waitTimeMs" value="100"/>
<property name="concurrentConsumers" value="1"/>
</bean>
<bean id="kestrel" class="org.apache.camel.component.kestrel.KestrelComponent">
<property name="configuration" ref="kestrelConfiguration"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">
</camelContext>
</beans>