297.5.4. CamelJobExecutionListener
CamelJobExecutionListener
は、ジョブ実行イベントを Camel エンドポイントに送信する org.springframework.batch.core.JobExecutionListener
インターフェースの実装です。
Spring Batch によって生成される org.springframework.batch.core.JobExecution
インスタンスは、メッセージのボディーとして送信されます。before- と after-callbacks SPRING_BATCH_JOB_EVENT_TYPE
ヘッダーを区別するために、BEFORE
または AFTER
の値に設定されます。
以下のスニペット例では、Spring Batch ジョブ実行イベントを JMS キューに送信します。
<bean id="camelJobExecutionListener" class="org.apache.camel.component.spring.batch.support.CamelJobExecutionListener"> <constructor-arg ref="producerTemplate"/> <constructor-arg value="jms:batchEventsBus"/> </bean> <batch:job id="myJob"> <batch:step id="step"> <batch:tasklet> <batch:chunk reader="someReader" writer="someWriter" commit-interval="100"/> </batch:tasklet> </batch:step> <batch:listeners> <batch:listener ref="camelJobExecutionListener"/> </batch:listeners> </batch:job>