You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2012/06/06 15:18:24 UTC

svn commit: r820482 - in /websites/production/camel/content: cache/main.pageCache springbatch.html

Author: buildbot
Date: Wed Jun  6 13:18:23 2012
New Revision: 820482

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 Wed Jun  6 13:18:23 2012
@@ -102,7 +102,14 @@ spring-batch:jobName[?options]
 
 <div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" valign="top"><img align="middle" src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif" width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1">This component can only be used to define producer endpoints, which means that you cannot use the Spring Batch component in a <tt>from()</tt> statement.</td></tr></table></div>
 
-<h3><a shape="rect" name="SpringBatch-Jobexecution"></a>Job execution</h3>
+<h3><a shape="rect" name="SpringBatch-Options"></a>Options</h3>
+
+<div class="table-wrap">
+<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Name </th><th colspan="1" rowspan="1" class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>jobLauncherRef</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 2.10:</b> Explicitly specifies the name of the <tt>JobLauncher</tt> to be used.</td></tr></tbody></table>
+</div>
+
+
+<h3><a shape="rect" name="SpringBatch-Usage"></a>Usage</h3>
 
 <p>When Spring Batch component receives the message, it triggers the job execution. The job will be executed using the <tt>org.springframework.batch.core.launch.JobLaucher</tt> instance resolved according to the following algorithm:</p>
 <ul><li>if <tt>JobLauncher</tt> is manually set on the component, then use it.</li><li>if <tt>jobLauncherRef</tt> option is set on the component, then search Camel Registry for the <tt>JobLauncher</tt> with the given name.</li><li>if there is <tt>JobLauncher</tt> registered in the Camel Registry under <b>jobLauncher</b> name, then use it.</li><li>if none of the steps above allow to resolve the <tt>JobLauncher</tt> and there is exactly one <tt>JobLauncher</tt> instance in the Camel Registry, then use it.</li></ul>
@@ -110,13 +117,73 @@ spring-batch:jobName[?options]
 
 <p>All headers found in the message are passed to the <tt>JobLauncher</tt> as job parameters. <tt>String</tt>, <tt>Long</tt>, <tt>Double</tt> and <tt>java.util.Date</tt> values are copied to the <tt>org.springframework.batch.core.JobParametersBuilder</tt> - other data types are converted to Strings.</p>
 
-<h3><a shape="rect" name="SpringBatch-Options"></a>Options</h3>
+<h3><a shape="rect" name="SpringBatch-Examples"></a>Examples</h3>
 
-<div class="table-wrap">
-<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Name </th><th colspan="1" rowspan="1" class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>jobLauncherRef</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 2.10:</b> Explicitly specifies the name of the <tt>JobLauncher</tt> to be used.</td></tr></tbody></table>
-</div>
+<p>Triggering Spring Batch job execution:</p>
 
-</div>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"direct:startBatch"</span>).to(<span class="code-quote">"spring-batch:myJob"</span>);
+</pre>
+</div></div>
+
+<p>Triggering Spring Batch job execution with the <tt>JabLauncher</tt> set explicitly. </p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"direct:startBatch"</span>).to(<span class="code-quote">"spring-batch:myJob?jobLauncherRef=myJobLauncher"</span>);
+</pre>
+</div></div>
+
+<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>
+
+<h4><a shape="rect" name="SpringBatch-CamelItemReader"></a>CamelItemReader</h4>
+
+<p><tt>CamelItemReader</tt> can be used to read batch data directly from the Camel infrastructure.</p>
+
+<p>For example the snippet below configures Spring Batch to read data from JMS queue.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-xml">
+<span class="code-tag">&lt;bean id=<span class="code-quote">"camelReader"</span> class=<span class="code-quote">"org.apache.camel.component.spring.batch.support.CamelItemReader"</span>&gt;</span>
+  <span class="code-tag">&lt;constructor-arg ref=<span class="code-quote">"consumerTemplate"</span>/&gt;</span>
+  <span class="code-tag">&lt;constructor-arg value=<span class="code-quote">"jms:dataQueue"</span>/&gt;</span>
+<span class="code-tag">&lt;/bean&gt;</span>
+
+<span class="code-tag">&lt;batch:job id=<span class="code-quote">"myJob"</span>&gt;</span>
+  <span class="code-tag">&lt;batch:step id=<span class="code-quote">"step"</span>&gt;</span>
+    <span class="code-tag">&lt;batch:tasklet&gt;</span>
+      <span class="code-tag">&lt;batch:chunk reader=<span class="code-quote">"camelReader"</span> writer=<span class="code-quote">"someWriter"</span> commit-interval=<span class="code-quote">"100"</span>/&gt;</span>
+    <span class="code-tag">&lt;/batch:tasklet&gt;</span>
+  <span class="code-tag">&lt;/batch:step&gt;</span>
+<span class="code-tag">&lt;/batch:job&gt;</span>
+</pre>
+</div></div>
+
+<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>For example the snippet below configures Spring Batch to read data from JMS queue.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-xml">
+<span class="code-tag">&lt;bean id=<span class="code-quote">"camelReader"</span> class=<span class="code-quote">"org.apache.camel.component.spring.batch.support.CamelItemReader"</span>&gt;</span>
+  <span class="code-tag">&lt;constructor-arg ref=<span class="code-quote">"consumerTemplate"</span>/&gt;</span>
+  <span class="code-tag">&lt;constructor-arg value=<span class="code-quote">"jms:dataQueue"</span>/&gt;</span>
+<span class="code-tag">&lt;/bean&gt;</span>
+
+<span class="code-tag">&lt;batch:job id=<span class="code-quote">"myJob"</span>&gt;</span>
+  <span class="code-tag">&lt;batch:step id=<span class="code-quote">"step"</span>&gt;</span>
+    <span class="code-tag">&lt;batch:tasklet&gt;</span>
+      <span class="code-tag">&lt;batch:chunk reader=<span class="code-quote">"camelReader"</span> writer=<span class="code-quote">"someWriter"</span> commit-interval=<span class="code-quote">"100"</span>/&gt;</span>
+    <span class="code-tag">&lt;/batch:tasklet&gt;</span>
+  <span class="code-tag">&lt;/batch:step&gt;</span>
+<span class="code-tag">&lt;/batch:job&gt;</span>
+</pre>
+</div></div></div>
         </td>
         <td valign="top">
           <div class="navigation">