Apache CamelでSpring XMLを使う際の大枠です。XMLのスキーマについては、使用するコンポーネントによっては追加が必要です。
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 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 "> <!-- Springの設定 --> <camelContext xmlns="http://camel.apache.org/schema/spring"> <!-- CamelContexttの設定 --> <root> <!-- ルートの設定 --> </root> </camelContext> </beans>
外部定義したプロパティを指定します。プロパティファイルによる値の設定参照。
<bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer"> <property name="location" value="classpath:com/buildria/camel/example/basis/example.properties"/> </bean>
<camelContext>
の属性については、CamelContextの属性参照。
スレッドプールプロファイルを定義します。スレッド参照。
<threadPoolProfile id="MyDefaultThreadPool" defaultProfile="true" poolSize="5" maxPoolSize="5" maxQueueSize="10000" keepAliveTime="60" rejectedPolicy="CallerRuns" />
スレッドプールを定義します。スレッド参照。
<threadPool id="MyCustomThreadPool" poolSize="10" maxPoolSize="10" threadName="MyCustomThread" />
外部定義したプロパティファイルを指定します。プロパティファイルによる値の設定参照。
<propertyPlaceholder id="properties" location="classpath:com/buildria/camel/example/basis/example.properties"/>
条件により処理を分岐します。Content Based Router参照。
<choice> <when> <simple>${header.type} == 'A'</simple> <log message="(2) Adding ${body} ..." /> </when> <otherwise> <log message="(4) Unknown Type: ${header.type}" /> </otherwise> </choice>
静的にルーチングルールを設定する。Routing Slip参照。
<routingSlip uriDelimiter="#" ignoreInvalidEndpoints="true" > <simple>${header.routingSlipHeader}</simple> </routingSlip>
特定の条件でフィルタリングを行う。Message Filter参照。
<filter> <simple>${header.type} == 'A'</simple> <log message="(2) filtered ${body}" /> </filter>
集約処理を行う。Aggregator参照。
<aggregate strategyRef="MyAggregationStrategy" completionSize="3"> <correlationExpression> <simple>${header.type}</simple> </correlationExpression> <log message="(2) aggregated: ${body}" /> </aggregate>
<log login="DEBUG" logName="com.buildria.camel.example" marker="boundary" message="process start" />