cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > Using the JMSConfigFeature
Date Thu, 03 Sep 2009 14:24:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CXF20DOC/Using+the+JMSConfigFeature">Using
the JMSConfigFeature</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~njiang">willem
jiang</a>
    </h4>
     Added the discription of cacheLevel
          <div id="versionComment" class="noteMacro" style="display:none; padding: 5px;">
     Added the discription of cacheLevel<br />
     </div>
          <br/>
     <div class="notificationGreySide">
         <p>In older CXF version the JMS transport is configured by defining a JMSConduit
or JMSDestination. Starting with CXF 2.0.9 and 2.1.3 the JMS transport includes an easier
configuration option that is more conformant to the spring dependency injection. Additionally
the new configuration has much more options. For example it is not necessary anymore to use
JNDI to resolve the connection factory. Instead it can be defined in the spring config.</p>

<p>The following example configs use the <a href="http://static.springframework.org/spring/docs/2.5.x/reference/beans.html"
rel="nofollow">p-namespace</a> from spring 2.5 but the old spring bean style is also
possible.</p>

<p>Inside a features element the JMSConfigFeature can be defined.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
 &lt;jaxws:client id=<span class="code-quote">"CustomerService"</span>
	xmlns:customer=<span class="code-quote">"http:<span class="code-comment">//customerservice.example.com/"</span>
</span>	serviceName=<span class="code-quote">"customer:CustomerServiceService"</span>
	endpointName=<span class="code-quote">"customer:CustomerServiceEndpoint"</span>
address=<span class="code-quote">"jms:<span class="code-comment">//"</span>
</span>	serviceClass=<span class="code-quote">"com.example.customerservice.CustomerService"</span>&gt;
	&lt;jaxws:features&gt;
		&lt;bean xmlns=<span class="code-quote">"http:<span class="code-comment">//www.springframework.org/schema/beans"</span>
</span>			class=<span class="code-quote">"org.apache.cxf.transport.jms.JMSConfigFeature"</span>
			p:jmsConfig-ref=<span class="code-quote">"jmsConfig"</span>/&gt;
	&lt;/jaxws:features&gt;
&lt;/jaxws:client&gt;
</pre>
</div></div>
<p>In the above example it references a bean "jmsConfig" where the whole configuration
for the JMS transport can be done.</p>

<p>A jaxws Endpoint can be defined in the same way:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;jaxws:endpoint 
	xmlns:customer=<span class="code-quote">"http:<span class="code-comment">//customerservice.example.com/"</span>
</span>	id=<span class="code-quote">"CustomerService"</span> 
	address=<span class="code-quote">"jms:<span class="code-comment">//"</span>
</span>	serviceName=<span class="code-quote">"customer:CustomerServiceService"</span>
	endpointName=<span class="code-quote">"customer:CustomerServiceEndpoint"</span>
	implementor=<span class="code-quote">"com.example.customerservice.impl.CustomerServiceImpl"</span>&gt;
	&lt;jaxws:features&gt;
		&lt;bean class=<span class="code-quote">"org.apache.cxf.transport.jms.JMSConfigFeature"</span>
			p:jmsConfig-ref=<span class="code-quote">"jmsConfig"</span> /&gt;
	&lt;/jaxws:features&gt;
&lt;/jaxws:endpoint&gt;
</pre>
</div></div>


<p>The JMSConfiguration bean needs at least a reference to a conncection factory and
a target destination.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
 &lt;bean id=<span class="code-quote">"jmsConfig"</span> class=<span class="code-quote">"org.apache.cxf.transport.jms.JMSConfiguration"</span>
	p:connectionFactory-ref=<span class="code-quote">"jmsConnectionFactory"</span>
	p:targetDestination=<span class="code-quote">"test.cxf.jmstransport.queue"</span>
/&gt;
</pre>
</div></div>
<p>If your ConnectionFactory does not cache connections you should wrap it in a spring
SingleConnectionFactory. This is necessary because the JMS Transport creates a new connection
for each message and the SingleConnectionFactory is needed to cache this connection.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
 &lt;bean id=<span class="code-quote">"jmsConnectionFactory"</span> class=<span
class="code-quote">"org.springframework.jms.connection.SingleConnectionFactory"</span>&gt;
	&lt;property name=<span class="code-quote">"targetConnectionFactory"</span>&gt;
		&lt;bean class=<span class="code-quote">"org.apache.activemq.ActiveMQConnectionFactory"</span>&gt;
			&lt;property name=<span class="code-quote">"brokerURL"</span> value=<span
class="code-quote">"tcp:<span class="code-comment">//localhost:61616"</span>
/&gt;
</span>		&lt;/bean&gt;
	&lt;/property&gt;
&lt;/bean&gt;
</pre>
</div></div>
<p>JMSConfiguration options:</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default <br clear="all" /> </th>
<th class='confluenceTh'> Description <br clear="all" /> </th>
</tr>
<tr>
<td class='confluenceTd'> connectionFactory </td>
<td class='confluenceTd'> (mandatory field) </td>
<td class='confluenceTd'> Reference to a bean that defines a jms ConnectionFactory.
Remember to wrap the connectionFactory like described above when not using a pooling ConnectionFactory
<br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> targetDestination </td>
<td class='confluenceTd'> <br clear="all" /> </td>
<td class='confluenceTd'> JNDI name or provider specific name of a destination. Example
for ActiveMQ: <br clear="all" />
test.cxf.jmstransport.queue </td>
</tr>
<tr>
<td class='confluenceTd'> replyDestination </td>
<td class='confluenceTd'> <br clear="all" /> </td>
<td class='confluenceTd'> <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> destinationResolver </td>
<td class='confluenceTd'> DynamicDestinationResolver </td>
<td class='confluenceTd'> Reference to a Spring DestinationResolver. This allows to
define how destination names are resolved to jms Destinations. By default a DynamicDestinationResolver
is used. It resolves destinations using the jms providers features. If you reference a JndiDestinationResolver
you can resolve the destination names using JNDI. <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> transactionManager <br clear="all" /> </td>
<td class='confluenceTd'> none </td>
<td class='confluenceTd'> Reference to a spring transaction manager. This allows to
take part in JTA Transactions with your webservice. <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> taskExecutor </td>
<td class='confluenceTd'> SimpleAsyncTaskExecutor </td>
<td class='confluenceTd'> Reference to a spring TaskExecutor. This is used in listeners
to decide how to handle incoming messages. Default is a spring SimpleAsyncTaskExecutor. <br
clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> useJms11 </td>
<td class='confluenceTd'> &gt; CXF 2.1.3: false </td>
<td class='confluenceTd'> true means JMS 1.1 features are used <br clear="all" />
false means only JMS 1.0.2 features are used <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> messageIdEnabled </td>
<td class='confluenceTd'> true </td>
<td class='confluenceTd'>&nbsp;</td>
</tr>
<tr>
<td class='confluenceTd'> messageTimestampEnabled </td>
<td class='confluenceTd'> true </td>
<td class='confluenceTd'>&nbsp;</td>
</tr>
<tr>
<td class='confluenceTd'> cacheLevel </td>
<td class='confluenceTd'> -1 </td>
<td class='confluenceTd'> Specify the level of caching that the JMS listener container
is allowed to apply. <br clear="all" />
Please check out the java doc of the org.springframework.jms.listenerDefaultMessageListenerContainer
for more information <br clear="all" />|</td>
</tr>
<tr>
<td class='confluenceTd'> pubSubNoLocal </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> true do not receive your own messages when using topics <br
clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> receiveTimeout </td>
<td class='confluenceTd'> 0 </td>
<td class='confluenceTd'> How many milliseconds to wait for response messages. 0 means
wait indefinitely <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> explicitQosEnabled </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> true means that QoS parameters are set for each message. </td>
</tr>
<tr>
<td class='confluenceTd'> deliveryMode </td>
<td class='confluenceTd'> 1 </td>
<td class='confluenceTd'> NON_PERSISTENT = 1 messages will only be kept in memory <br
clear="all" />
<br clear="all" />
PERSISTENT = 2&nbsp;&nbsp;&nbsp; messages will be persisted to disk <br clear="all"
/> </td>
</tr>
<tr>
<td class='confluenceTd'> priority </td>
<td class='confluenceTd'> 4 <br clear="all" /> </td>
<td class='confluenceTd'> Priority for the messages. See your JMS provider doc for details
<br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> timeToLive </td>
<td class='confluenceTd'> 0 </td>
<td class='confluenceTd'> After this time the message will be discarded by the jms provider
<br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> sessionTransacted </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> true means JMS transactions are used <br clear="all" />
</td>
</tr>
<tr>
<td class='confluenceTd'> concurrentConsumers </td>
<td class='confluenceTd'> 1 </td>
<td class='confluenceTd'> minimum number of concurrent consumers for listener <br
clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> maxConcurrentConsumers </td>
<td class='confluenceTd'> 1 </td>
<td class='confluenceTd'> maximum number of concurrent consumers for listener </td>
</tr>
<tr>
<td class='confluenceTd'> maxConcurrentTasks </td>
<td class='confluenceTd'> 10 </td>
<td class='confluenceTd'> Maximum number of threads that handle the received requests
(available from cxf 2.1.4 upwards) </td>
</tr>
<tr>
<td class='confluenceTd'> messageSelector <br clear="all" /> </td>
<td class='confluenceTd'> <br clear="all" /> </td>
<td class='confluenceTd'> jms selector to filter incoming messages (allows to share
a queue) <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> subscriptionDurable <br clear="all" /> </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'>&nbsp;</td>
</tr>
<tr>
<td class='confluenceTd'> durableSubscriptionName <br clear="all" /> </td>
<td class='confluenceTd'> <br clear="all" /> </td>
<td class='confluenceTd'>&nbsp;</td>
</tr>
<tr>
<td class='confluenceTd'> messageType <br clear="all" /> </td>
<td class='confluenceTd'> text <br clear="all" /> </td>
<td class='confluenceTd'> text <br clear="all" />
binary <br clear="all" />
byte <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> pubSubDomain <br clear="all" /> </td>
<td class='confluenceTd'> false <br clear="all" /> </td>
<td class='confluenceTd'> false means use queues <br clear="all" />
true means use topics <br clear="all" /> </td>
</tr>
</tbody></table>
<p><br clear="all" /></p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CXF20DOC/Using+the+JMSConfigFeature">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=100809&revisedVersion=6&originalVersion=5">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CXF20DOC/Using+the+JMSConfigFeature?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message