Author: buildbot Date: Tue Jun 12 08:18:11 2012 New Revision: 821373 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/springbatch.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/springbatch.html ============================================================================== --- websites/production/camel/content/springbatch.html (original) +++ websites/production/camel/content/springbatch.html Tue Jun 12 08:18:11 2012 @@ -119,7 +119,7 @@ spring-batch:jobName[?options] <h3><a shape="rect" name="SpringBatch-Examples"></a>Examples</h3> -<p>Triggering Spring Batch job execution:</p> +<p>Triggering the Spring Batch job execution:</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> <pre class="code-java"> @@ -127,7 +127,7 @@ from(<span class="code-quote">"direct:st </pre> </div></div> -<p>Triggering Spring Batch job execution with the <tt>JabLauncher</tt> set explicitly. </p> +<p>Triggering the Spring Batch job execution with the <tt>JobLauncher</tt> set explicitly. </p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> <pre class="code-java"> @@ -137,7 +137,7 @@ from(<span class="code-quote">"direct:st <h3><a shape="rect" name="SpringBatch-Supportclasses"></a>Support classes</h3> -<p>Apart from the Component, Camel Spring Batch provides also support classes to hook into Spring Batch infrastructure.</p> +<p>Apart from the Component, Camel Spring Batch provides also support classes, which can be used to hook into Spring Batch infrastructure.</p> <h4><a shape="rect" name="SpringBatch-CamelItemReader"></a>CamelItemReader</h4> @@ -164,7 +164,7 @@ from(<span class="code-quote">"direct:st <h4><a shape="rect" name="SpringBatch-CamelItemWriter"></a>CamelItemWriter</h4> -<p><tt>CamelItemWriter</tt> has similar purpose as <tt>CamelItemReader</tt>, but it is dedicated to write chunk of processed </p> +<p><tt>CamelItemWriter</tt> has similar purpose as <tt>CamelItemReader</tt>, but it is dedicated to write chunk of the processed data.</p> <p>For example the snippet below configures Spring Batch to read data from JMS queue.</p> @@ -183,6 +183,68 @@ from(<span class="code-quote">"direct:st <span class="code-tag"></batch:step></span> <span class="code-tag"></batch:job></span> </pre> +</div></div> + +<h4><a shape="rect" name="SpringBatch-CamelItemProcessor"></a>CamelItemProcessor</h4> + +<p><tt>CamelItemProcessor</tt> is the implementation of Spring Batch <tt>org.springframework.batch.item.ItemProcessor</tt> interface. The latter implementation relays on <a shape="rect" class="external-link" href="http://camel.apache.org/request-reply.html">Request Reply pattern</a> to delegate the processing of the batch item to the Camel infrastructure. The item to process is sent to the Camel endpoint as the body of the message.</p> + +<p>For example the snippet below performs simple processing of the batch item using the <a shape="rect" class="external-link" href="http://camel.apache.org/direct.html">Direct endpoint </a> and the <a shape="rect" class="external-link" href="http://camel.apache.org/simple.html">Simple expression language </a>.</p> + +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<pre class="code-xml"> +<span class="code-tag"><camel:camelContext></span> + <span class="code-tag"><camel:route></span> + <span class="code-tag"><camel:from uri=<span class="code-quote">"direct:processor"</span>/></span> + <span class="code-tag"><camel:setExchangePattern pattern=<span class="code-quote">"InOut"</span>/></span> + <span class="code-tag"><camel:setBody></span> + <span class="code-tag"><camel:simple></span>Processed ${body}<span class="code-tag"></camel:simple></span> + <span class="code-tag"></camel:setBody></span> + <span class="code-tag"></camel:route></span> +<span class="code-tag"></camel:camelContext></span> + +<span class="code-tag"><bean id=<span class="code-quote">"camelProcessor"</span> class=<span class="code-quote">"org.apache.camel.component.spring.batch.support.CamelItemProcessor"</span>></span> + <span class="code-tag"><constructor-arg ref=<span class="code-quote">"producerTemplate"</span>/></span> + <span class="code-tag"><constructor-arg value=<span class="code-quote">"direct:processor"</span>/></span> +<span class="code-tag"></bean></span> + +<span class="code-tag"><batch:job id=<span class="code-quote">"myJob"</span>></span> + <span class="code-tag"><batch:step id=<span class="code-quote">"step"</span>></span> + <span class="code-tag"><batch:tasklet></span> + <span class="code-tag"><batch:chunk reader=<span class="code-quote">"someReader"</span> writer=<span class="code-quote">"someWriter"</span> processor=<span class="code-quote">"camelProcessor"</span> commit-interval=<span class="code-quote">"100"</span>/></span> + <span class="code-tag"></batch:tasklet></span> + <span class="code-tag"></batch:step></span> +<span class="code-tag"></batch:job></span> +</pre> +</div></div> + + +<h4><a shape="rect" name="SpringBatch-CamelJobExecutionListener"></a>CamelJobExecutionListener</h4> + +<p><tt>CamelJobExecutionListener</tt> is the implementation of the <tt>org.springframework.batch.core.JobExecutionListener</tt> interface sending job execution events to the Camel endpoint.</p> + +<p>The <tt>org.springframework.batch.core.JobExecution</tt> instance produced by the Spring Batch is sent as a body of the message. To distinguish between before- and after-callbacks <tt>SPRING_BATCH_JOB_EVENT_TYPE</tt> header is set to the <tt>BEFORE</tt> or <tt>AFTER</tt> value.</p> + +<p>The example snippet below sends Spring Batch job execution events to the JMS queue.</p> + +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<pre class="code-xml"> +<span class="code-tag"><bean id=<span class="code-quote">"camelJobExecutionListener"</span> class=<span class="code-quote">"org.apache.camel.component.spring.batch.support.CamelJobExecutionListener"</span>></span> + <span class="code-tag"><constructor-arg ref=<span class="code-quote">"producerTemplate"</span>/></span> + <span class="code-tag"><constructor-arg value=<span class="code-quote">"jms:batchEventsBus"</span>/></span> +<span class="code-tag"></bean></span> + +<span class="code-tag"><batch:job id=<span class="code-quote">"myJob"</span>></span> + <span class="code-tag"><batch:step id=<span class="code-quote">"step"</span>></span> + <span class="code-tag"><batch:tasklet></span> + <span class="code-tag"><batch:chunk reader=<span class="code-quote">"someReader"</span> writer=<span class="code-quote">"someWriter"</span> commit-interval=<span class="code-quote">"100"</span>/></span> + <span class="code-tag"></batch:tasklet></span> + <span class="code-tag"></batch:step></span> + <span class="code-tag"><batch:listeners></span> + <span class="code-tag"><batch:listener ref=<span class="code-quote">"camelJobExecutionListener"</span>/></span> + <span class="code-tag"></batch:listeners></span> +<span class="code-tag"></batch:job></span> +</pre> </div></div></div> </td> <td valign="top">