camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > JT400
Date Fri, 04 Mar 2011 07:06:01 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2036/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/JT400">JT400</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (6)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h2. JT/400 Component <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >The *{{jt400}}* component allows
you to exchanges messages with an AS/400 system using data queues. <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">
This components is only available in Camel 1.5 and above.</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Maven users will need to
add the following dependency to their {{pom.xml}} for this component: <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">To
call remote program (*Camel 2.7*) <br>{code} <br>jt400://user:password@system/QSYS.LIB/LIBRARY.LIB/program.PGM[?options]
<br>{code} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >You can append query options to the
URI in the following format, {{?option=value&amp;option=value&amp;...}} <br>
<br>h3. URI options <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>For the data queue message exchange: <br></td></tr>
            <tr><td class="diff-unchanged" >{div:class=confluenceTableSmall} <br>||
Name || Default value || Description || <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{div} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">For
the remote program call (*Camel 2.7*) <br>{div:class=confluenceTableSmall} <br>||
Name || Default value || Description || <br>| {{outputFieldsIdx}} |  | Specifies which
fields (program parameters) are output parameters. | <br>| {{fieldsLength}} |  | Specifies
the fields (program parameters) length as in the AS/400 program definition. | <br>{div}
<br> <br></td></tr>
            <tr><td class="diff-unchanged" >h3. Usage <br>When configured
as a consumer endpoint, the endpoint will poll a data queue on a remote system.  For every
entry on the data queue, a new {{Exchange}} is sent with the entry&#39;s data in the _In_
message&#39;s body, formatted either as a {{String}} or a {{byte[]}}, depending on the
format.  For a provider endpoint, the _In_ message body contents will be put on the data queue
as either raw bytes or text. <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h4.
Remote program call (*Camel 2.7*) <br> <br>This endpoint expects the input to
be a String array and handles all the CCSID handling trough the native jt400 library mechanisms.
After the program execution the endpoint returns a String array with the values as they were
returned by the program (the input only parameters will contain the same data as the beginning
of the invocation) <br>This endpoint does not implement a provider endpoint! <br>
<br></td></tr>
            <tr><td class="diff-unchanged" >h3. Example <br>In the snippet
below, the data for an exchange sent to the {{direct:george}} endpoint will be put in the
data queue {{PENNYLANE}} in library {{BEATLES}} on a system named {{LIVERPOOL}}.  \\ <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code:java} <br>public class
Jt400RouteBuilder extends RouteBuilder { <br></td></tr>
            <tr><td class="diff-unchanged" >    @Override <br>    public
void configure() throws Exception { <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h4.
Remote program call example (*Camel 2.7*) <br> <br>In the snippet below, the data
Exchange sent to the direct:work endpoint will contain three string that will be used as the
arguments for the program “compute” in the library “assets”. This program will write
the output values in the 2nd and 3rd parameters. All the parameters will be sent to the direct:play
endpoint. <br>{code:java} <br>public class Jt400RouteBuilder extends RouteBuilder
{ <br>    @Override <br>    public void configure() throws Exception { <br>
      from(&quot;direct:work&quot;).to(&quot;jt400://GRUPO:ATWORK@server/QSYS.LIB/assets.LIB/compute.PGM?fieldsLength=10,10,512&amp;ouputFieldsIdx=2,3&quot;).to(“direct:play”);
<br>    } <br>} <br>{code} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >{include:Endpoint See Also} <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="JT400-JT%2F400Component"></a>JT/400 Component</h2>

<p>The <b><tt>jt400</tt></b> component allows you to exchanges
messages with an AS/400 system using data queues.</p>

<p>Maven users will need to add the following dependency to their <tt>pom.xml</tt>
for this component:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;dependency&gt;</span>
    <span class="code-tag">&lt;groupId&gt;</span>org.apache.camel<span
class="code-tag">&lt;/groupId&gt;</span>
    <span class="code-tag">&lt;artifactId&gt;</span>camel-jt400<span
class="code-tag">&lt;/artifactId&gt;</span>
    <span class="code-tag">&lt;version&gt;</span>x.x.x<span class="code-tag">&lt;/version&gt;</span>
    <span class="code-tag"><span class="code-comment">&lt;!-- use the same
version as your Camel core version --&gt;</span></span>
<span class="code-tag">&lt;/dependency&gt;</span>
</pre>
</div></div>

<h3><a name="JT400-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
jt400:<span class="code-comment">//user:password@system/QSYS.LIB/LIBRARY.LIB/QUEUE.DTAQ[?options]</span>
</pre>
</div></div>

<p>To call remote program (<b>Camel 2.7</b>)</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
jt400:<span class="code-comment">//user:password@system/QSYS.LIB/LIBRARY.LIB/program.PGM[?options]</span>
</pre>
</div></div>

<p>You can append query options to the URI in the following format, <tt>?option=value&amp;option=value&amp;...</tt></p>

<h3><a name="JT400-URIoptions"></a>URI options</h3>

<p>For the data queue message exchange:</p>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default value </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>ccsid</tt> </td>
<td class='confluenceTd'> default system CCSID </td>
<td class='confluenceTd'> Specifies the CCSID to use for the connection with the AS/400
system. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>format</tt> </td>
<td class='confluenceTd'> <tt>text</tt> </td>
<td class='confluenceTd'> Specifies the data format for sending messages <br class="atl-forced-newline"
/> valid options are: <tt>text</tt> (represented by <tt>String</tt>)
and <tt>binary</tt> (represented by <tt>byte[]</tt>) </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>consumer.delay</tt> </td>
<td class='confluenceTd'> <tt>500</tt> </td>
<td class='confluenceTd'> Delay in milliseconds between each poll. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>consumer.initialDelay</tt> </td>
<td class='confluenceTd'> <tt>1000</tt> </td>
<td class='confluenceTd'> Milliseconds before polling starts. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>consumer.userFixedDelay</tt> </td>
<td class='confluenceTd'> <tt>false</tt> </td>
<td class='confluenceTd'> <tt>true</tt> to use fixed delay between polls,
otherwise fixed rate is used. See <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html"
class="external-link" rel="nofollow">ScheduledExecutorService</a> in JDK for details.
</td>
</tr>
</tbody></table>
</div>
</div>

<p>For the remote program call (<b>Camel 2.7</b>)</p>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default value </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>outputFieldsIdx</tt> </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> Specifies which fields (program parameters) are output parameters.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>fieldsLength</tt> </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> Specifies the fields (program parameters) length as in the
AS/400 program definition. </td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="JT400-Usage"></a>Usage</h3>
<p>When configured as a consumer endpoint, the endpoint will poll a data queue on a
remote system.  For every entry on the data queue, a new <tt>Exchange</tt> is
sent with the entry's data in the <em>In</em> message's body, formatted either
as a <tt>String</tt> or a <tt>byte[]</tt>, depending on the format.
 For a provider endpoint, the <em>In</em> message body contents will be put on
the data queue as either raw bytes or text.</p>

<h4><a name="JT400-Remoteprogramcall%28Camel2.7%29"></a>Remote program call
(<b>Camel 2.7</b>)</h4>

<p>This endpoint expects the input to be a String array and handles all the CCSID handling
trough the native jt400 library mechanisms. After the program execution the endpoint returns
a String array with the values as they were returned by the program (the input only parameters
will contain the same data as the beginning of the invocation)<br/>
This endpoint does not implement a provider endpoint!</p>

<h3><a name="JT400-Example"></a>Example</h3>
<p>In the snippet below, the data for an exchange sent to the <tt>direct:george</tt>
endpoint will be put in the data queue <tt>PENNYLANE</tt> in library <tt>BEATLES</tt>
on a system named <tt>LIVERPOOL</tt>.  <br class="atl-forced-newline" />
Another user connects to the same data queue to receive the information from the data queue
and forward it to the <tt>mock:ringo</tt> endpoint.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">public</span> class Jt400RouteBuilder <span class="code-keyword">extends</span>
RouteBuilder {
    @Override
    <span class="code-keyword">public</span> void configure() <span class="code-keyword">throws</span>
Exception {
       from(<span class="code-quote">"direct:george"</span>).to(<span class="code-quote">"jt400:<span
class="code-comment">//GEORGE:EGROEG@LIVERPOOL/QSYS.LIB/BEATLES.LIB/PENNYLANE.DTAQ"</span>);
</span>       from(<span class="code-quote">"jt400:<span class="code-comment">//RINGO:OGNIR@LIVERPOOL/QSYS.LIB/BEATLES.LIB/PENNYLANE.DTAQ"</span>).to(<span
class="code-quote">"mock:ringo"</span>);
</span>    }
}
</pre>
</div></div>

<h4><a name="JT400-Remoteprogramcallexample%28Camel2.7%29"></a>Remote program
call example (<b>Camel 2.7</b>)</h4>

<p>In the snippet below, the data Exchange sent to the direct:work endpoint will contain
three string that will be used as the arguments for the program “compute” in the library
“assets”. This program will write the output values in the 2nd and 3rd parameters. All
the parameters will be sent to the direct:play endpoint.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">public</span> class Jt400RouteBuilder <span class="code-keyword">extends</span>
RouteBuilder {
    @Override
    <span class="code-keyword">public</span> void configure() <span class="code-keyword">throws</span>
Exception {
       from(<span class="code-quote">"direct:work"</span>).to(<span class="code-quote">"jt400:<span
class="code-comment">//GRUPO:ATWORK@server/QSYS.LIB/assets.LIB/compute.PGM?fieldsLength=10,10,512&amp;ouputFieldsIdx=2,3"</span>).to(“direct:play”);
</span>    }
}
</pre>
</div></div>

<h3><a name="JT400-SeeAlso"></a>See Also</h3>
<ul>
	<li><a href="/confluence/display/CAMEL/Configuring+Camel" title="Configuring Camel">Configuring
Camel</a></li>
	<li><a href="/confluence/display/CAMEL/Component" title="Component">Component</a></li>
	<li><a href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a></li>
	<li><a href="/confluence/display/CAMEL/Getting+Started" title="Getting Started">Getting
Started</a></li>
</ul>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/JT400">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=90948&revisedVersion=6&originalVersion=5">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/JT400?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message