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 > JMS Transport
Date Wed, 16 Jun 2010 18:02:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CXF20DOC&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/CXF20DOC/JMS+Transport">JMS
Transport</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~dkulp">Daniel
Kulp</a>
    </h4>
        <br/>
                         <h4>Changes (1)</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" >| {{messageSelector}} | Specifies
the string value of a message selector to use. For more information on the syntax used to
specify message \\ <br> selectors, see the JMS 1.1 specification. | <br></td></tr>
            <tr><td class="diff-changed-lines" >| {{transactional}} | Specifies
whether the local JMS broker will create transactions around message processing. The default
is {{false}}. <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Currently,
this is not supported by the runtime.</span> | <br></td></tr>
            <tr><td class="diff-unchanged" >The following example shows a CXF
configuration entry for configuring a JMS service endpoint. <br>{code:title=Configuration
for a JMS Service Endpoint} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="JMSTransport-UsingtheJavaMessageService"></a>Using
the Java Message Service</h1>

<p>CXF provides a transport plug-in that enables endpoints to use Java Message Service
(JMS) queues and topics. CXF's JMS transport plug-in uses the Java Naming and Directory Interface
(JNDI) to locate and obtain references to the JMS provider that brokers for the JMS destinations.
Once CXF has established a connection to a JMS provider, CXF supports the passing of messages
packaged as either a JMS <tt>ObjectMessage</tt> or a JMS <tt>TextMessage</tt>.</p>

<h2><a name="JMSTransport-EasierconfigurationusingthenewJMSConfigFeature"></a>Easier
configuration using the new JMSConfigFeature</h2>

<p>Starting with CXF 2.0.9 and 2.1.3 there is a new easier and more flexible configuration
style available. See <a href="/confluence/display/CXF20DOC/Using+the+JMSConfigFeature"
title="Using the JMSConfigFeature">Using the JMSConfigFeature</a></p>

<h2><a name="JMSTransport-JMSTransportwihtSOAPoverJavaMessageService1.0Supported"></a>JMS
Transport wiht SOAP over Java Message Service 1.0-Supported </h2>

<p>Starting with the CXF 2.3 , we make some improvement on the JMS Transport to support
<a href="http://www.w3.org/TR/soapjms/" class="external-link" rel="nofollow">SOAP over
JMS specification</a>. See <a href="/confluence/display/CXF20DOC/SOAP+over+JMS+1.0+support"
title="SOAP over JMS 1.0 support">SOAP over JMS 1.0 support</a> for more information.</p>

<h2><a name="JMSTransport-JMSNamespaces"></a>JMS Namespaces</h2>


<h3><a name="JMSTransport-WSDLNamespace"></a>WSDL Namespace</h3>

<p>The WSDL extensions for defining a JMS endpoint are defined in the namespace <tt><a
href="http://cxf.apache.org/transports/jms" class="external-link" rel="nofollow">http://cxf.apache.org/transports/jms</a></tt>.
In order to use the JMS extensions you will need to add the namespace definition shown below
to the definitions element of your contract.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>JMS Extension Namespace</b></div><div
class="codeContent panelContent">
<pre class="code-java">
xmlns:jms=<span class="code-quote">"http:<span class="code-comment">//cxf.apache.org/transports/jms"</span></span>
</pre>
</div></div>

<h3><a name="JMSTransport-ConfigurationNamespaces"></a>Configuration Namespaces</h3>

<p>In order to use the JMS configuration properties you will need to add the line shown
below to the <tt>beans</tt> element of your configuration.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>JMS Configuration Namespaces</b></div><div
class="codeContent panelContent">
<pre class="code-java">
xmlns:jms=<span class="code-quote">"http:<span class="code-comment">//cxf.apache.org/transports/jms"</span></span>
</pre>
</div></div>

<h2><a name="JMSTransport-BasicEndpointConfiguration"></a>Basic Endpoint
Configuration</h2>

<p>JMS endpoints need to know certain basic information about how to establish a connection
to the proper destination. This information can be provided in one of two places: WSDL or
XML configuration. The following configuration elements which are described can be used in
both the client side Conduits and the server side Destinations.</p>

<h3><a name="JMSTransport-UsingWSDL"></a>Using WSDL</h3>

<p>The JMS destination information is provided using the <tt>jms:address</tt>
element and its child, the <tt>jms:JMSNamingProperties</tt> element. The <tt>jms:address</tt>
element's attributes specify the information needed to identify the JMS broker and the destination.
The <tt>jms:JMSNamingProperties</tt> element specifies the Java properties used
to connect to the JNDI service.</p>

<h4><a name="JMSTransport-Theaddresselement"></a>The address element</h4>

<p>The basic configuration for a JMS endpoint is done by using a <tt>jms:address</tt>
element as the child of your service's <tt>port</tt> element. The <tt>jms:address</tt>
element uses the attributes described below to configure the connection to the JMS broker.</p>

<p><a name="JMSTransport-addressTable"></a></p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Attribute </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>destinationStyle</tt> </td>
<td class='confluenceTd'> Specifies if the JMS destination is a JMS queue or a JMS topic.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>jndiConnectionFactoryName</tt> </td>
<td class='confluenceTd'> Specifies the JNDI name bound to the JMS connection factory
to use when connecting to the JMS destination. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>jndiDestinationName</tt> </td>
<td class='confluenceTd'> Specifies the JNDI name bound to the JMS destination to which
requests are sent. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>jndiReplyDestinationName</tt> </td>
<td class='confluenceTd'> Specifies the JNDI name bound to the JMS destinations where
replies are sent. This attribute allows you to use a user defined destination for replies.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>connectionUserName</tt> </td>
<td class='confluenceTd'> Specifies the username to use when connecting to a JMS broker.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>connectionPassword</tt> </td>
<td class='confluenceTd'> Specifies the password to use when connecting to a JMS broker.
</td>
</tr>
</tbody></table>
</div>


<h4><a name="JMSTransport-TheJMSNamingPropertieselement"></a>The JMSNamingProperties
element</h4>

<p>To increase interoperability with JMS and JNDI providers, the <tt>jms:address</tt>
element has a child element, <tt>jms:JMSNamingProperties</tt>, that allows you
to specify the values used to populate the properties used when connecting to the JNDI provider.
The <tt>jms:JMSNamingProperties</tt> element has two attributes: <tt>name</tt>
and <tt>value</tt>. The <tt>name</tt> attribute specifies the name
of the property to set. The <tt>value</tt> attribute specifies the value for the
specified property. The <tt>jms:JMSNamingProperties</tt> element can also be used
for specification of provider specific properties.<br/>
The following is a list of common JNDI properties that can be set:</p>
<ol>
	<li><tt>java.naming.factory.initial</tt></li>
	<li><tt>java.naming.provider.url</tt></li>
	<li><tt>java.naming.factory.object</tt></li>
	<li><tt>java.naming.factory.state</tt></li>
	<li><tt>java.naming.factory.url.pkgs</tt></li>
	<li><tt>java.naming.dns.url</tt></li>
	<li><tt>java.naming.authoritative</tt></li>
	<li><tt>java.naming.batchsize</tt></li>
	<li><tt>java.naming.referral</tt></li>
	<li><tt>java.naming.security.protocol</tt></li>
	<li><tt>java.naming.security.authentication</tt></li>
	<li><tt>java.naming.security.principal</tt></li>
	<li><tt>java.naming.security.credentials</tt></li>
	<li><tt>java.naming.language</tt></li>
	<li><tt>java.naming.applet</tt></li>
</ol>


<p>For more details on what information to use in these attributes, check your JNDI
provider's documentation and consult the Java API reference material.</p>

<h4><a name="JMSTransport-Usinganamedreplydestination"></a>Using a named
reply destination</h4>

<p>By default, CXF endpoints using JMS create a temporary queue for sending replies
back and forth. You can change this behavior by setting the <tt>jndiReplyDestinationName</tt>
attribute in the endpoint's contract. A client endpoint will listen for replies on the specified
destination and it will specify the value of the attribute in the <tt>ReplyTo</tt>
field of all outgoing requests. A service endpoint will use the value of the <tt>jndiReplyDestinationName</tt>
attribute as the location for placing replies if there is no destination specified in the
request's <tt>ReplyTo</tt> field.</p>

<p>As of CXF 2.1.3 and 2.0.9 a static reply queue can not be shared by several instances
of the service client. Please use a dynamic reply queue or different queue names per instance
instead. (<a href="http://www.nabble.com/CXF-2.1.3-JMS-Conduit-to20447067.html" class="external-link"
rel="nofollow">See discussion on the mailing list</a>)</p>

<p>The following example shows an example of a JMS WSDL port specification.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>JMS WSDL Port Specification</b></div><div
class="codeContent panelContent">
<pre class="code-java">
&lt;service name=<span class="code-quote">"JMSService"</span>&gt;
  &lt;port binding=<span class="code-quote">"tns:Greeter_SOAPBinding"</span>
name=<span class="code-quote">"SoapPort"</span>&gt;
    &lt;jms:address jndiConnectionFactoryName=<span class="code-quote">"ConnectionFactory"</span>
                 jndiDestinationName=<span class="code-quote">"dynamicQueues/test.cxf.jmstransport"</span>&gt;
      &lt;jms:JMSNamingProperty name=<span class="code-quote">"java.naming.factory.initial"</span>
                             value=<span class="code-quote">"org.apache.activemq.jndi.ActiveMQInitialContextFactory"</span>
/&gt;
      &lt;jms:JMSNamingProperty name=<span class="code-quote">"java.naming.provider.url"</span>
                             value=<span class="code-quote">"tcp:<span class="code-comment">//localhost:61616"</span>
/&gt;
</span>    &lt;/jms:address&gt;
  &lt;/port&gt;
&lt;/service&gt;
</pre>
</div></div>

<h3><a name="JMSTransport-UsingConfiguration"></a>Using Configuration</h3>

<p>In addition to using the WSDL file to specify the connection information for a JMS
endpoint, you can also supply it in the endpoint's XML configuration. The information in the
configuration file will override the information in the endpoint's WSDL file.</p>

<h4><a name="JMSTransport-Configurationelements"></a>Configuration elements</h4>

<p>You configure a JMS endpoint using one of the following configuration elements:</p>
<ul>
	<li><b>jms:conduit</b>:&nbsp;The <tt>jms:conduit</tt> element
contains the configuration for a consumer endpoint. It has one attribute, <tt>name</tt>,
whose value takes the form
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>{WSDLNamespace}WSDLPortName.jms-conduit
</pre>
</div></div>
<p>.</p></li>
	<li><b>jms:destination</b>:&nbsp;The <tt>jms:destination</tt>
element contains the configuration for a provider endpoint. It has one attribute, <tt>name</tt>,
whose value takes the form
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>{WSDLNamespace}WSDLPortName.jms-destination
</pre>
</div></div>
<p>.</p></li>
</ul>


<h4><a name="JMSTransport-The%7B%7Baddress%7D%7Delement"></a>The <tt>address</tt>
element</h4>

<p>JMS connection information is specified by adding a <tt>jms:address</tt>
child to the base configuration element. The <tt>jms:address</tt> element used
in the configuration file is identical to the one used in the WSDL file. Its attributes are
listed in the <a href="#JMSTransport-addressTable">address element's attribute table</a>.
Like the jms:address element in the WSDL file, the jms:address configuration element also
has a <tt>jms:JMSNamingProperties</tt> child element that is used to specify additional
information used to connect to a JNDI provider.</p>

<h4><a name="JMSTransport-Example"></a>Example</h4>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Addressing Information a Configuration File</b></div><div
class="codeContent panelContent">
<pre class="code-java">
&lt;beans xmlns=<span class="code-quote">"http:<span class="code-comment">//www.springframework.org/schema/beans"</span>
</span>       xmlns:xsi=<span class="code-quote">"http:<span class="code-comment">//www.w3.org/2001/XMLSchema-instance"</span>
</span>       xmlns:ct=<span class="code-quote">"http:<span class="code-comment">//cxf.apache.org/configuration/types"</span>
</span>       xmlns:jms=<span class="code-quote">"http:<span class="code-comment">//cxf.apache.org/transports/jms"</span>
</span>       xsi:schemaLocation="http:<span class="code-comment">//www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
</span>                           http:<span class="code-comment">//cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
</span>                           http:<span class="code-comment">//cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd"&gt;
</span>&lt;jms:conduit name=<span class="code-quote">"{http:<span class="code-comment">//cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-conduit"</span>&gt;
</span>  &lt;jms:address destinationStyle=<span class="code-quote">"queue"</span>
               jndiConnectionFactoryName=<span class="code-quote">"myConnectionFactory"</span>
               jndiDestinationName=<span class="code-quote">"myDestination"</span>
               jndiReplyDestinationName=<span class="code-quote">"myReplyDestination"</span>
               connectionUserName=<span class="code-quote">"testUser"</span>
               connectionPassword=<span class="code-quote">"testPassword"</span>&gt;
    &lt;jms:JMSNamingProperty name=<span class="code-quote">"java.naming.factory.initial"</span>
                           value=<span class="code-quote">"org.apache.cxf.transport.jms.MyInitialContextFactory"</span>/&gt;
    &lt;jms:JMSNamingProperty name=<span class="code-quote">"java.naming.provider.url"</span>
                           value=<span class="code-quote">"tcp:<span class="code-comment">//localhost:61616"</span>/&gt;
</span>  &lt;/jms:address&gt;
&lt;/jms:conduit&gt;
&lt;/beans&gt;
</pre>
</div></div>

<h3><a name="JMSTransport-ConsumerEndpointConfiguration"></a>Consumer Endpoint
Configuration</h3>

<p>JMS consumer endpoints specify the type of messages they use. JMS consumer endpoint
can use either a JMS <tt>ObjectMessage</tt> or a JMS <tt>TextMessage</tt>.
When using an <tt>ObjectMessage</tt> the consumer endpoint uses a <tt>byte[]</tt>
as the method for storing data into and retrieving data from the JMS message body. When messages
are sent, the message data, including any formating information, is packaged into a <tt>byte[]</tt>
and placed into the JMS message body before it is placed on the wire. When messages are received,
the consumer endpoint will attempt to unmarshall the data stored in the JMS body as if it
were packed in a <tt>byte[]</tt>.</p>

<p>When using a <tt>TextMessage</tt>, the consumer endpoint uses a string
as the method for storing and retrieving data from the JMS message body. When messages are
sent, the message information, including any format-specific information, is converted into
a string and placed into the JMS message body. When messages are received the consumer endpoint
will attempt to unmashall the data stored in the JMS message body as if it were packed into
a string.</p>

<p>When native JMS applications interact with CXF consumers, the JMS application is
responsible for interpreting the message and the formatting information. For example, if the
CXF contract specifies that the binding used for a JMS endpoint is SOAP, and the messages
are packaged as <tt>TextMessage</tt>, the receiving JMS application will get a
text message containing all of the SOAP envelope information.</p>

<p>Consumer endpoint can be configured by both XML configuration and via WSDL.</p>

<h3><a name="JMSTransport-UsingConfiguration"></a>Using Configuration</h3>


<h4><a name="JMSTransport-Specifyingthemessagetype"></a>Specifying the message
type</h4>

<p>You can specify the message type supported by the consumer endpoint using a <tt>jms:runtimePolicy</tt>
element that has a single attribute:</p>
<ul>
	<li><tt>messageType</tt> &#45; Specifies how the message data will
be packaged as a JMS message. <tt>text</tt> specifies that the data will be packaged
as a <tt>TextMessage</tt>. <tt>binary</tt> specifies that the data
will be packaged as an <tt>ObjectMessage</tt>.</li>
</ul>


<p>The following example shows a configuration entry for configuring a JMS consumer
endpoint.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Configuration for a JMS Consumer Endpoint</b></div><div
class="codeContent panelContent">
<pre class="code-java">
&lt;beans xmlns=<span class="code-quote">"http:<span class="code-comment">//www.springframework.org/schema/beans"</span>
</span>       xmlns:xsi=<span class="code-quote">"http:<span class="code-comment">//www.w3.org/2001/XMLSchema-instance"</span>
</span>       xmlns:ct=<span class="code-quote">"http:<span class="code-comment">//cxf.apache.org/configuration/types"</span>
</span>       xmlns:jms=<span class="code-quote">"http:<span class="code-comment">//cxf.apache.org/transports/jms"</span>
</span>       xsi:schemaLocation=<span class="code-quote">"http:<span class="code-comment">//www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd"</span>
</span>                           http:<span class="code-comment">//cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
</span>                           http:<span class="code-comment">//cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd"&gt;
</span>...
&lt;jms:conduit name=<span class="code-quote">"{http:<span class="code-comment">//cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-conduit"</span>&gt;
</span>  &lt;jms:address ... &gt;
    ...
  &lt;/jms:address&gt;
  &lt;jms:runtimePolicy messageType=<span class="code-quote">"binary"</span>/&gt;
...
&lt;/jms:conduit&gt;
...
&lt;/beans&gt;
</pre>
</div></div>
<p>The id on the <tt>jms:conduit</tt> is in the form of {<tt><em>WSDLNamespace</em>}<em>WSDLPortName</em>.jms-conduit</tt>.
This provides CXF with the information so that it can associate the configuration with your
service's endpoint.</p>

<h3><a name="JMSTransport-UsingWSDL"></a>Using WSDL</h3>

<p>The type of messages accepted by a JMS consumer endpoint is configured using the
optional <tt>jms:client</tt> element. The <tt>jms:client</tt> element
is a child of the WSDL port element and has one attribute:</p>
<ul>
	<li><tt>messageType</tt> &#45; Specifies how the message data will
be packaged as a JMS message. <tt>text</tt> specifies that the data will be packaged
as a <tt>TextMessage</tt>. <tt>binary</tt> specifies that the data
will be packaged as an ObjectMessage.</li>
</ul>


<h2><a name="JMSTransport-ServiceEndpointConfiguration"></a>Service Endpoint
Configuration</h2>

<p>JMS service endpoints have a number of behaviors that are configurable in the contract.
These include:</p>
<ul>
	<li>how messages are correlated</li>
	<li>the use of durable subscriptions</li>
	<li>if the service uses local JMS transactions</li>
	<li>the message selectors used by the endpoint</li>
</ul>


<p>Service endpoints can be configure in one of two ways:</p>
<ul>
	<li>Configuration</li>
	<li>WSDL</li>
</ul>


<h3><a name="JMSTransport-UsingConfiguration"></a>Using Configuration</h3>


<h4><a name="JMSTransport-Specifyingconfigurationdata"></a>Specifying configuration
data</h4>

<p>Using the <tt>jms:destination</tt> elements you can configure your service's
endpoint. You can specify the service endpoint's behaviors using the <tt>jms:runtimePolicy</tt>
element that has a the following attributes:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Attribute </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>useMessageIDAsCorrealationID</tt> </td>
<td class='confluenceTd'> Specifies whether the JMS broker will use the message ID to
correlate messages. The default is <tt>false</tt>. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>durableSubscriberName</tt> </td>
<td class='confluenceTd'> Specifies the name used to register a durable subscription.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>messageSelector</tt> </td>
<td class='confluenceTd'> Specifies the string value of a message selector to use. For
more information on the syntax used to specify message <br class="atl-forced-newline" />
 selectors, see the JMS 1.1 specification. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>transactional</tt> </td>
<td class='confluenceTd'> Specifies whether the local JMS broker will create transactions
around message processing. The default is <tt>false</tt>. </td>
</tr>
</tbody></table>
</div>

<p>The following example shows a CXF configuration entry for configuring a JMS service
endpoint.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Configuration for a JMS Service Endpoint</b></div><div
class="codeContent panelContent">
<pre class="code-java">
&lt;beans xmlns=<span class="code-quote">"http:<span class="code-comment">//www.springframework.org/schema/beans"</span>
</span>       xmlns:xsi=<span class="code-quote">"http:<span class="code-comment">//www.w3.org/2001/XMLSchema-instance"</span>
</span>       xmlns:ct=<span class="code-quote">"http:<span class="code-comment">//cxf.apache.org/configuration/types"</span>
</span>       xmlns:jms=<span class="code-quote">"http:<span class="code-comment">//cxf.apache.org/transports/jms"</span>
</span>       xsi:schemaLocation=<span class="code-quote">"http:<span class="code-comment">//www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd"</span>
</span>                           http:<span class="code-comment">//cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
</span>                           http:<span class="code-comment">//cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd"&gt;
</span>...
&lt;jms:destination name=<span class="code-quote">"{http:<span class="code-comment">//cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-destination"</span>&gt;
</span>  &lt;jms:address ... &gt;
    ...
  &lt;/jms:address&gt;
  ...
  &lt;jms:runtimePolicy messageSelector=<span class="code-quote">"cxf_message_selector"</span>
                     useMessageIDAsCorrelationID=<span class="code-quote">"<span
class="code-keyword">true</span>"</span>
                     transactional=<span class="code-quote">"<span class="code-keyword">true</span>"</span>
                     durableSubscriberName=<span class="code-quote">"cxf_subscriber"</span>
/&gt;
  ...
&lt;/jms:destination&gt;
...
&lt;/beans&gt;
</pre>
</div></div>

<h3><a name="JMSTransport-UsingWSDL"></a>Using WSDL</h3>

<p>Service endpoint behaviors are configured using the optional <tt>jms:server</tt>
element. The <tt>jms:server</tt> element is a child of the WSDL <tt>port</tt>
element and has the following attributes:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Attribute </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>useMessageIDAsCorrealationID</tt> </td>
<td class='confluenceTd'> Specifies whether JMS will use the message ID to correlate
messages. The default is <tt>false</tt>. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>durableSubscriberName</tt> </td>
<td class='confluenceTd'> Specifies the name used to register a durable subscription.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>messageSelector</tt> </td>
<td class='confluenceTd'> Specifies the string value of a message selector to use. For
more information on the syntax used to specify message <br class="atl-forced-newline" />
 selectors, see the JMS 1.1 specification. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>transactional</tt> </td>
<td class='confluenceTd'> Specifies whether the local JMS broker will create transactions
around message processing. The default is <tt>false</tt>. Currently, this is not
supported by the runtime. </td>
</tr>
</tbody></table>
</div>


<h2><a name="JMSTransport-JMSRuntimeConfiguration"></a>JMS Runtime Configuration</h2>

<p>In addition to configuring the externally visible aspects of your JMS endpoint, you
can also configure aspects of its internal runtime behavior. There are three types of runtime
configuration:</p>
<ul>
	<li>Session pool configuration (common to both services and consumers)</li>
	<li>Consumer specific configuration</li>
	<li>Service specific configuration</li>
</ul>


<h3><a name="JMSTransport-SessionPoolConfiguration"></a>Session Pool Configuration</h3>

<p>You configure an endpoint's JMS session pool using the <tt>jms:sessionPoolConfig</tt>
element. This property allows you to set a high and low water mark for the number of JMS sessions
an endpoint will keep pooled. The endpoint is guaranteed to maintain a pool of sessions equal
to the low water mark and to never pool more sessions than specified by the high water mark.<br/>
The <tt>jms:sessionPool</tt> element's attributes, listed below, specify the high
and low water marks for the endpoint's JMS session pool.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Attribute </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>lowWaterMark</tt> </td>
<td class='confluenceTd'> Specifies the minimum number of JMS sessions pooled by the
endpoint. The default is 20. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>highWaterMark</tt> </td>
<td class='confluenceTd'> Specifies the maximum number of JMS sessions pooled by the
endpoint. The default is 500. </td>
</tr>
</tbody></table>
</div>

<p>The following example shows an example of configuring the session pool for a CXF
JMS service endpoint.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>JMS Session Pool Configuration</b></div><div
class="codeContent panelContent">
<pre class="code-java">
&lt;jms:destination name=<span class="code-quote">"{http:<span class="code-comment">//cxf.apache.org/jms_endpit}HelloWorldJMSPort.jms-destination"</span>&gt;
</span>...
  &lt;jms:sessionPool lowWaterMark=<span class="code-quote">"10"</span> highWaterMark=<span
class="code-quote">"5000"</span> /&gt;
&lt;/jms:destination&gt;
</pre>
</div></div>
<p>The <tt>jms:sessionPool</tt> element can also be used within a <tt>jms:conduit</tt>.</p>

<h3><a name="JMSTransport-ConsumerSpecificRuntimeConfiguration"></a>Consumer
Specific Runtime Configuration</h3>

<p>The JMS consumer configuration allows you to specify two runtime behaviors:</p>
<ul>
	<li>the number of milliseconds the consumer will wait for a response.</li>
	<li>the number of milliseconds a request will exist before the JMS broker can remove
it.</li>
</ul>


<p>You use the <tt>jms:clientConfig</tt> element to set JMS consumer runtime
behavior. This element's attributes, listed in the following table, specify the configuration
values for consumer runtime behavior.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Attribute </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>clientReceiveTimeout</tt> </td>
<td class='confluenceTd'> Specifies the amount of time, in milliseconds, that the endpoint
will wait for a response before it times out and issues an exception. The default value is
2000. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>messageTimeToLive</tt> </td>
<td class='confluenceTd'> Specifies the amount of time, in milliseconds, that a request
can remain unrecieved before the JMS broker can delete it. The default value is 0 which specifies
that the message can never be deleted. </td>
</tr>
</tbody></table>
</div>

<p>The following example shows a configuration fragment that sets the consumer endpoint's
request lifetime to 500 milliseconds and its timeout value to 500 milliseconds.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>JMS Consumer Endpoint Runtime Configuration</b></div><div
class="codeContent panelContent">
<pre class="code-java">
&lt;jms:conduit name=<span class="code-quote">"{http:<span class="code-comment">//cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-conduit"</span>&gt;
</span>...
  &lt;jms:clientConfig clientReceiveTimeout=<span class="code-quote">"500"</span>
                    messageTimeToLive=<span class="code-quote">"500"</span> /&gt;
&lt;/jms:conduit&gt;
</pre>
</div></div>

<h3><a name="JMSTransport-ServiceSpecificRuntimeConfiguration"></a>Service
Specific Runtime Configuration</h3>

<p>The JMS service configuration allows you to specify to runtime behaviors:</p>
<ul>
	<li>the amount of time a response message can remain unreceived before the JMS broker
can delete it.</li>
	<li>the client identifier used when creating and accessing durable subscriptions.</li>
</ul>


<p>The <tt>jms:serverConfig</tt> element is used to specify the service
runtime configuration. This element's attributes, listed below, specify the configuration
values that control the service's runtime behavior.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Attribute </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>messageTimeToLive</tt> </td>
<td class='confluenceTd'> Specifies the amount of time, in milliseconds, that a response
can remain unread before the JMS broker is allowed to delete it. The default is 0 which specifies
that the message can live forever. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>durableSubscriptionClientId</tt> </td>
<td class='confluenceTd'> Specifies the client identifier the endpoint uses to create
and access durable subscriptions. </td>
</tr>
</tbody></table>
</div>

<p>The following example shows a configuration fragment that sets the service endpoint's
response lifetime to 500 milliseconds and its durable subscription client identifier to <tt>jms-test-id</tt>.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>JMS Service Endpoint Runtime Configuration</b></div><div
class="codeContent panelContent">
<pre class="code-java">
&lt;jms:destination id=<span class="code-quote">"{http:<span class="code-comment">//cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-destination"</span>&gt;
</span>  &lt;jms:address ... &gt;
    ...
  &lt;/jms:address&gt;
  &lt;jms:serverConfig messageTimeToLive=<span class="code-quote">"500"</span>
                    durableSubscriptionClientId=<span class="code-quote">"jms-test-id"</span>
/&gt;
&lt;/jms:destination&gt;
</pre>
</div></div>
    </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/CXF20DOC/JMS+Transport">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=29587&revisedVersion=23&originalVersion=22">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JMS+Transport?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message