camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > SJMS
Date Mon, 06 Aug 2012 04:41:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/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/SJMS">SJMS</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~sully6768">Scott
England-Sullivan</a>
    </h4>
        <br/>
                         <h4>Changes (16)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >|| Option || Default Value || Description
|| <br>| {{acknowledgementMode}} | {{AUTO_ACKNOWLEDGE}}  | The JMS acknowledgement name,
which is one of: {{TRANSACTED}}, {{CLIENT_ACKNOWLEDGE}}, {{AUTO_ACKNOWLEDGE}}, {{DUPS_OK_ACKNOWLEDGE}}
| <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">|
{{consumerCount}} | {{1}}  | Defines the number of MessageListener instances that will be
used with the InOut endpoint. | <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
{{consumerCount}} | {{1}}  | *InOut only.* Defines the number of MessageListener instances
that for response consumers. | <br></td></tr>
            <tr><td class="diff-unchanged" >| {{exchangePattern}} | {{InOnly}}
 | Sets the Producers message exchange pattern. | <br></td></tr>
            <tr><td class="diff-changed-lines" >| {{namedReplyTo}} | {{null}}
 | <span class="diff-added-words"style="background-color: #dfd;">*InOut only.*</span>
Specifies a named reply to destination for <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">InOut
endpoint.</span> <span class="diff-added-words"style="background-color: #dfd;">responses.</span>
| <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
{{persistent}} | {{true}}  | Whether a message should be delivered with persistence enabled.
| <br></td></tr>
            <tr><td class="diff-unchanged" >| {{producerCount}} | {{1}}  | Defines
the number of MessageProducer instances. | <br></td></tr>
            <tr><td class="diff-changed-lines" >| {{responseTimeOut}} | {{5000}}
 | <span class="diff-added-words"style="background-color: #dfd;">*InOut only.*</span>
Specifies the amount of time an <span class="diff-changed-words">InOut<span class="diff-added-chars"style="background-color:
#dfd;"> </span>Producer</span> will wait for its response. | <br></td></tr>
            <tr><td class="diff-unchanged" >| {{synchronous}} | {{true}}  | Sets
whether the Endpoint will use synchronous or asynchronous processing. | <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
{{transacted}} | {{false}}  | If the endpoint should use a JMS Session transaction. | <br></td></tr>
            <tr><td class="diff-unchanged" >| {{ttl}} | {{-1}}  | Disabled by
default.  Sets the Message time to live header. | <br>{div} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h3.
Consumers <br> <br>The SjmsConsumer Endpoint supports the following properties:
<br> <br>{div:class=confluenceTableSmall} <br>|| Option || Default Value
|| Description || <br>| {{acknowledgementMode}} | {{AUTO_ACKNOWLEDGE}}  | The JMS acknowledgement
name, which is one of: {{TRANSACTED}}, {{CLIENT_ACKNOWLEDGE}}, {{AUTO_ACKNOWLEDGE}}, {{DUPS_OK_ACKNOWLEDGE}}
| <br>| {{consumerCount}} | {{1}}  | Defines the number of MessageListener instances.
| <br>| {{durableSubscriptionId}} | {{null}} | Required for a durable subscriptions.
| <br>| {{exchangePattern}} | {{InOnly}}  | Sets the Consumers message exchange pattern.
| <br>| {{messageSelector}} | {{null}}  | Sets the message selector. | <br>| {{synchronous}}
| {{true}}  | Sets whether the Endpoint will use synchronous or asynchronous processing. |
<br>| {{transacted}} | {{false}}  | If the endpoint should use a JMS Session transaction.
| <br>| {{ttl}} | {{-1}}  | Disabled by default.  Sets the Message time to live header.
| <br>{div} <br> <br>h3. Examples <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h4. InOnly Producer - (Default) <br>
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h4. InOut Producer <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">To
enable InOut behavior with the  <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">To
enable InOut behavior append the {{exchangePattern}} attribute to the URI.  By default it
will use a dedicated TemporaryQueue for each consumer. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code} <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-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h4.
SJMS Consumer <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">You
can specify a {{namedReplyTo}} though which can provide a better monitor point. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">from(&quot;direct:start&quot;)
<br>    .to(&quot;sjms:queue:bar?exchangePattern=InOut&amp;namedReplyTo=my.reply.to.queue&quot;);
<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h4.
Transactions {anchor:transactionCacheLevels} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h4.
Does Springless Mean I Can&#39;t Use Spring? <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">There
is currently no support the Camel Transaction Processor nor does it support the Camel Transaction
API. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Not
at all.  Below is an example of the SJMS component using the Spring DSL: <br> <br>{code}
<br>&lt;route <br>    id=&quot;inout.named.reply.to.producer.route&quot;&gt;
<br>    &lt;from <br>        uri=&quot;direct:invoke.named.reply.to.queue&quot;
/&gt; <br>    &lt;to <br>        uri=&quot;sjms:queue:named.reply.to.queue?namedReplyTo=my.response.queue&amp;amp;exchangePattern=InOut&quot;
/&gt; <br>&lt;/route&gt; <br>{code} <br> <br> It is just
not using the Spring JMS APIs to provide the JMS Client container.  A new container is being
developed from the ground up to power SJMS.  So for example, you  <br> <br>h3.
Transaction Support {anchor:transactionCacheLevels} <br> <br>There is currently
no support the Camel Transaction Processor nor does it support the Java Transaction API (JTA).
 Only internal JMS Session Transactions are supported at this time. <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="SJMS-SJMSComponent"></a>SJMS Component</h2>

<p><b>Available as of Camel 2.11</b></p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>This component is under active
development.</td></tr></table></div>

<p>The SJMS Component is a JMS client for Camel based purely on the JMS API.  It will
be released as part of Camel 2.11 with the following functionality:</p>

<ul>
	<li>Queue and Topic Support (Durable &amp; Non-Durable)</li>
	<li>InOnly &amp; InOut Support</li>
	<li>Plugable Connection Resource Management</li>
	<li>Session, Consumer, &amp; Producer Pooling &amp; Caching Management</li>
	<li>Asynchronous Producer and Consumer Processing</li>
	<li>Internal JMS Transaction Support</li>
</ul>


<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>Why the S
in SJMS</b><br />S stands for Simple and Standard and Springless.  Also camel-jms
was already taken. <img class="emoticon" src="/confluence/images/icons/emoticons/smile.gif"
height="20" width="20" align="absmiddle" alt="" border="0"/></td></tr></table></div>

<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-sjms<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="SJMS-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
sjms:[queue:|topic:]destinationName[?options]
</pre>
</div></div>

<p>Where <tt>destinationName</tt> is a JMS queue or topic name. By default,
the <tt>destinationName</tt> is interpreted as a queue name. For example, to connect
to the queue, <tt>FOO.BAR</tt> use:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
sjms:FOO.BAR
</pre>
</div></div>

<p>You can include the optional <tt>queue:</tt> prefix, if you prefer:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
sjms:queue:FOO.BAR
</pre>
</div></div>

<p>To connect to a topic, you <em>must</em> include the <tt>topic:</tt>
prefix. For example, to connect to the topic, <tt>Stocks.Prices</tt>, use:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
sjms:topic:Stocks.Prices
</pre>
</div></div>

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

<h3><a name="SJMS-SjmsComponentOptionsandConfigurations"></a>SjmsComponent
Options and Configurations</h3>

<p>Below is an example of how to configure the SjmsComponent with its required ConnectionFactory
provider.  It will create a single connection by default and store it using the components
internal pooling APIs to ensure that it is able to service Session creation requests in a
thread safe manner.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
SjmsComponent component = <span class="code-keyword">new</span> SjmsComponent();
component.setConnectionFactory(<span class="code-keyword">new</span> ActiveMQConnectionFactory(<span
class="code-quote">"tcp:<span class="code-comment">//localhost:61616"</span>));
</span>getContext().addComponent(<span class="code-quote">"sjms"</span>,
component);
</pre>
</div></div>

<p>For a SjmsComponent that is required to support a durable subscription, you can override
the default ConnectionFactoryResource instance and set the <b>clientId</b> property.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
ConnectionFactoryResource connectionResource = <span class="code-keyword">new</span>
ConnectionFactoryResource();
connectionResource.setConnectionFactory(<span class="code-keyword">new</span>
ActiveMQConnectionFactory(<span class="code-quote">"tcp:<span class="code-comment">//localhost:61616"</span>));
</span>connectionResource.setClientId(<span class="code-quote">"myclient-id"</span>);

SjmsComponent component = <span class="code-keyword">new</span> SjmsComponent();
component.setConnectionResource(connectionResource);
component.setMaxConnections(1);
</pre>
</div></div>

<h3><a name="SJMS-Producers"></a>Producers</h3>

<p>The SjmsProducer Endpoint supports the following properties:</p>

<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Option </th>
<th class='confluenceTh'> Default Value </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>acknowledgementMode</tt> </td>
<td class='confluenceTd'> <tt>AUTO_ACKNOWLEDGE</tt>  </td>
<td class='confluenceTd'> The JMS acknowledgement name, which is one of: <tt>TRANSACTED</tt>,
<tt>CLIENT_ACKNOWLEDGE</tt>, <tt>AUTO_ACKNOWLEDGE</tt>, <tt>DUPS_OK_ACKNOWLEDGE</tt>
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>consumerCount</tt> </td>
<td class='confluenceTd'> <tt>1</tt>  </td>
<td class='confluenceTd'> <b>InOut only.</b> Defines the number of MessageListener
instances that for response consumers. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>exchangePattern</tt> </td>
<td class='confluenceTd'> <tt>InOnly</tt>  </td>
<td class='confluenceTd'> Sets the Producers message exchange pattern. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>namedReplyTo</tt> </td>
<td class='confluenceTd'> <tt>null</tt>  </td>
<td class='confluenceTd'> <b>InOut only.</b> Specifies a named reply to
destination for responses. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>persistent</tt> </td>
<td class='confluenceTd'> <tt>true</tt>  </td>
<td class='confluenceTd'> Whether a message should be delivered with persistence enabled.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>producerCount</tt> </td>
<td class='confluenceTd'> <tt>1</tt>  </td>
<td class='confluenceTd'> Defines the number of MessageProducer instances. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>responseTimeOut</tt> </td>
<td class='confluenceTd'> <tt>5000</tt>  </td>
<td class='confluenceTd'> <b>InOut only.</b> Specifies the amount of time
an InOut Producer will wait for its response. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>synchronous</tt> </td>
<td class='confluenceTd'> <tt>true</tt>  </td>
<td class='confluenceTd'> Sets whether the Endpoint will use synchronous or asynchronous
processing. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>transacted</tt> </td>
<td class='confluenceTd'> <tt>false</tt>  </td>
<td class='confluenceTd'> If the endpoint should use a JMS Session transaction. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>ttl</tt> </td>
<td class='confluenceTd'> <tt>-1</tt>  </td>
<td class='confluenceTd'> Disabled by default.  Sets the Message time to live header.
</td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="SJMS-Consumers"></a>Consumers</h3>

<p>The SjmsConsumer Endpoint supports the following properties:</p>

<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Option </th>
<th class='confluenceTh'> Default Value </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>acknowledgementMode</tt> </td>
<td class='confluenceTd'> <tt>AUTO_ACKNOWLEDGE</tt>  </td>
<td class='confluenceTd'> The JMS acknowledgement name, which is one of: <tt>TRANSACTED</tt>,
<tt>CLIENT_ACKNOWLEDGE</tt>, <tt>AUTO_ACKNOWLEDGE</tt>, <tt>DUPS_OK_ACKNOWLEDGE</tt>
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>consumerCount</tt> </td>
<td class='confluenceTd'> <tt>1</tt>  </td>
<td class='confluenceTd'> Defines the number of MessageListener instances. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>durableSubscriptionId</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Required for a durable subscriptions. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>exchangePattern</tt> </td>
<td class='confluenceTd'> <tt>InOnly</tt>  </td>
<td class='confluenceTd'> Sets the Consumers message exchange pattern. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>messageSelector</tt> </td>
<td class='confluenceTd'> <tt>null</tt>  </td>
<td class='confluenceTd'> Sets the message selector. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>synchronous</tt> </td>
<td class='confluenceTd'> <tt>true</tt>  </td>
<td class='confluenceTd'> Sets whether the Endpoint will use synchronous or asynchronous
processing. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>transacted</tt> </td>
<td class='confluenceTd'> <tt>false</tt>  </td>
<td class='confluenceTd'> If the endpoint should use a JMS Session transaction. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>ttl</tt> </td>
<td class='confluenceTd'> <tt>-1</tt>  </td>
<td class='confluenceTd'> Disabled by default.  Sets the Message time to live header.
</td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="SJMS-Examples"></a>Examples</h3>

<h4><a name="SJMS-InOnlyProducer%28Default%29"></a>InOnly Producer - (Default)</h4>

<p>The InOnly Producer is the default behavior of the SJMS Producer Endpoint.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"direct:start"</span>)
    .to(<span class="code-quote">"sjms:queue:bar"</span>);
</pre>
</div></div>

<h4><a name="SJMS-InOutProducer"></a>InOut Producer</h4>

<p>To enable InOut behavior append the <tt>exchangePattern</tt> attribute
to the URI.  By default it will use a dedicated TemporaryQueue for each consumer.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"direct:start"</span>)
    .to(<span class="code-quote">"sjms:queue:bar?exchangePattern=InOut"</span>);
</pre>
</div></div>

<p>You can specify a <tt>namedReplyTo</tt> though which can provide a better
monitor point.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"direct:start"</span>)
    .to(<span class="code-quote">"sjms:queue:bar?exchangePattern=InOut&amp;namedReplyTo=my.reply.to.queue"</span>);
</pre>
</div></div>

<h4><a name="SJMS-DoesSpringlessMeanICan%27tUseSpring%3F"></a>Does Springless
Mean I Can't Use Spring?</h4>

<p>Not at all.  Below is an example of the SJMS component using the Spring DSL:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;route
    id=<span class="code-quote">"inout.named.reply.to.producer.route"</span>&gt;
    &lt;from
        uri=<span class="code-quote">"direct:invoke.named.reply.to.queue"</span>
/&gt;
    &lt;to
        uri=<span class="code-quote">"sjms:queue:named.reply.to.queue?namedReplyTo=my.response.queue&amp;amp;exchangePattern=InOut"</span>
/&gt;
&lt;/route&gt;
</pre>
</div></div>

<p> It is just not using the Spring JMS APIs to provide the JMS Client container.  A
new container is being developed from the ground up to power SJMS.  So for example, you </p>

<h3><a name="SJMS-TransactionSupport"></a>Transaction Support <a name="SJMS-transactionCacheLevels"></a></h3>

<p>There is currently no support the Camel Transaction Processor nor does it support
the Java Transaction API (JTA).  Only internal JMS Session Transactions are supported at this
time.</p>
    </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/SJMS">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=29688695&revisedVersion=11&originalVersion=10">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/SJMS?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message