blob: ad37fbc3df89567d12205329c0fe62489b803c58 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<link type="text/css" rel="stylesheet" href="/resources/site.css">
<script src='/resources/space.js'></script>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="keywords" content="business integration, EAI, SOA, Service Oriented Architecture, web services, SOAP, JBI, JMS, WSDL, XML, EDI, Electronic Data Interchange, standards support, integration standards, application integration, middleware, software, solutions, services, CXF, open source">
<meta name="description" content="Apache CXF, Services Framework - CXF 2.x JMS configuration (removed in CXF 3)">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shCoreCXF.css">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
<script src='/resources/highlighter/scripts/shBrushBash.js'></script>
<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
</script>
<title>
Apache CXF -- CXF 2.x JMS configuration (removed in CXF 3)
</title>
</head>
<body onload="init()">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td id="cell-0-0" colspan="2">&nbsp;</td>
<td id="cell-0-1">&nbsp;</td>
<td id="cell-0-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-1-0">&nbsp;</td>
<td id="cell-1-1">&nbsp;</td>
<td id="cell-1-2">
<!-- Banner -->
<div class="banner" id="banner"><div><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="left" colspan="1" nowrap>
<a shape="rect" href="http://cxf.apache.org/" title="Apache CXF"><span style="font-weight: bold; font-size: 170%; color: white">Apache CXF</span></a>
</td><td align="right" colspan="1" nowrap>
<a shape="rect" href="http://www.apache.org/" title="The Apache Sofware Foundation"><img border="0" alt="ASF Logo" src="http://cxf.apache.org/images/asf-logo.png"></a>
</td></tr></table></div></div>
<!-- Banner -->
<div id="top-menu">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td>
<div align="left">
<!-- Breadcrumbs -->
<a href="index.html">Index</a>&nbsp;&gt;&nbsp;<a href="transports.html">Transports</a>&nbsp;&gt;&nbsp;<a href="jms-transport.html">JMS Transport</a>&nbsp;&gt;&nbsp;<a href="cxf-2x-jms-configuration-removed-in-cxf-3.html">CXF 2.x JMS configuration (removed in CXF 3)</a>
<!-- Breadcrumbs -->
</div>
</td>
<td>
<div align="right">
<!-- Quicklinks -->
<div id="quicklinks"><p><a shape="rect" href="http://cxf.apache.org/download.html">Download</a> | <a shape="rect" href="http://cxf.apache.org/docs/index.html">Documentation</a></p></div>
<!-- Quicklinks -->
</div>
</td>
</tr>
</table>
</div>
</td>
<td id="cell-1-3">&nbsp;</td>
<td id="cell-1-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-2-0" colspan="2">&nbsp;</td>
<td id="cell-2-1">
<table>
<tr valign="top">
<td height="100%">
<div id="wrapper-menu-page-right">
<div id="wrapper-menu-page-top">
<div id="wrapper-menu-page-bottom">
<div id="menu-page">
<!-- NavigationBar -->
<div id="navigation"><ul class="alternate"><li><a shape="rect" href="overview.html">Overview</a></li><li><a shape="rect" href="how-tos.html">How-Tos</a></li><li><a shape="rect" href="frontends.html">Frontends</a></li><li><a shape="rect" href="databindings.html">DataBindings</a></li><li><a shape="rect" href="transports.html">Transports</a></li><li><a shape="rect" href="configuration.html">Configuration</a></li><li><a shape="rect" href="debugging-and-logging.html">Debugging and Logging</a></li><li><a shape="rect" href="tools.html">Tools</a></li><li><a shape="rect" href="restful-services.html">RESTful Services</a></li><li><a shape="rect" href="wsdl-bindings.html">WSDL Bindings</a></li><li><a shape="rect" href="service-routing.html">Service Routing</a></li><li><a shape="rect" href="dynamic-languages.html">Dynamic Languages</a></li><li><a shape="rect" href="ws-support.html">WS-* Support</a></li><li><a shape="rect" href="advanced-integration.html">Advanced Integration</a></li><li><a shape="rect" href="deployment.html">Deployment</a></li><li><a shape="rect" href="schemas-and-namespaces.html">Use of Schemas and Namespaces</a></li></ul><hr><ul class="alternate"><li><p>Search</p></li></ul><form enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box" action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="002890367768291051730:o99qiwa09y4">
<input type="hidden" name="ie" value="UTF-8">
<input type="text" name="q" size="21">
<input type="submit" name="sa" value="Search">
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script><hr><ul class="alternate"><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest/">API 3.2.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest-3.1.x/">API 3.1.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF Website</a></li></ul><p>&#160;</p><p><a shape="rect" class="external-link" href="http://www.apache.org/events/current-event.html"><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://www.apache.org/events/current-event-125x125.png" data-image-src="http://www.apache.org/events/current-event-125x125.png"></span></a></p></div>
<!-- NavigationBar -->
</div>
</div>
</div>
</div>
</td>
<td height="100%">
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p>Standard JMS transport configuration in CXF is done by defining a JMSConduit or JMSDestination, discussed below.</p><h2 id="CXF2.xJMSconfiguration(removedinCXF3)-JMSNamespaces">JMS Namespaces</h2><h3 id="CXF2.xJMSconfiguration(removedinCXF3)-WSDLNamespace">WSDL Namespace</h3><p>The WSDL extensions for defining a JMS endpoint are defined in the namespace <code><a shape="rect" href="http://cxf.apache.org/transports/jms">http://cxf.apache.org/transports/jms</a></code>. 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 pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JMS Extension Namespace</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">xmlns:jms="http://cxf.apache.org/transports/jms"
</pre>
</div></div><h3 id="CXF2.xJMSconfiguration(removedinCXF3)-ConfigurationNamespaces">Configuration Namespaces</h3><p>In order to use the JMS configuration properties you will need to add the line shown below to the <code>beans</code> element of your configuration.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JMS Configuration Namespaces</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">xmlns:jms="http://cxf.apache.org/transports/jms"
</pre>
</div></div><h2 id="CXF2.xJMSconfiguration(removedinCXF3)-BasicEndpointConfiguration">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 id="CXF2.xJMSconfiguration(removedinCXF3)-UsingWSDL">Using WSDL</h3><p>The JMS destination information is provided using the <code><a shape="rect" class="external-link" href="http://jmsaddress" rel="nofollow">jms:address</a></code> element and its child, the <code>jms:JMSNamingProperties</code> element. The <code><a shape="rect" class="external-link" href="http://jmsaddress" rel="nofollow">jms:address</a></code> element's attributes specify the information needed to identify the JMS broker and the destination. The <code>jms:JMSNamingProperties</code> element specifies the Java properties used to connect to the JNDI service.</p><h4 id="CXF2.xJMSconfiguration(removedinCXF3)-Theaddresselement">The address element</h4><p>The basic configuration for a JMS endpoint is done by using a <code><a shape="rect" class="external-link" href="http://jmsaddress" rel="nofollow">jms:address</a></code> element as the child of your service's <code>port</code> element. The <code><a shape="rect" class="external-link" href="http://jmsaddress" rel="nofollow">jms:address</a></code> element uses the attributes described below to configure the connection to the JMS broker.</p><p><span class="confluence-anchor-link" id="CXF2.xJMSconfiguration(removedinCXF3)-addressTable"></span></p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>destinationStyle</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies if the JMS destination is a JMS queue or a JMS topic.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>jndiConnectionFactoryName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the JNDI name bound to the JMS connection factory to use when connecting to the JMS destination.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>jndiDestinationName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the JNDI name bound to the JMS destination to which requests are sent.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>jndiReplyDestinationName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>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.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>connectionUserName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the username to use when connecting to a JMS broker.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>connectionPassword</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the password to use when connecting to a JMS broker.</p></td></tr></tbody></table></div><h4 id="CXF2.xJMSconfiguration(removedinCXF3)-TheJMSNamingPropertieselement">The JMSNamingProperties element</h4><p>To increase interoperability with JMS and JNDI providers, the <code><a shape="rect" class="external-link" href="http://jmsaddress" rel="nofollow">jms:address</a></code> element has a child element, <code>jms:JMSNamingProperties</code>, that allows you to specify the values used to populate the properties used when connecting to the JNDI provider. The <code>jms:JMSNamingProperties</code> element has two attributes: <code>name</code> and <code>value</code>. The <code>name</code> attribute specifies the name of the property to set. The <code>value</code> attribute specifies the value for the specified property. The <code>jms:JMSNamingProperties</code> element can also be used for specification of provider specific properties.<br clear="none"> The following is a list of common JNDI properties that can be set:</p><ol><li><code>java.naming.factory.initial</code></li><li><code>java.naming.provider.url</code></li><li><code>java.naming.factory.object</code></li><li><code>java.naming.factory.state</code></li><li><code>java.naming.factory.url.pkgs</code></li><li><code>java.naming.dns.url</code></li><li><code>java.naming.authoritative</code></li><li><code>java.naming.batchsize</code></li><li><code>java.naming.referral</code></li><li><code>java.naming.security.protocol</code></li><li><code>java.naming.security.authentication</code></li><li><code>java.naming.security.principal</code></li><li><code>java.naming.security.credentials</code></li><li><code>java.naming.language</code></li><li><code>java.naming.applet</code></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 id="CXF2.xJMSconfiguration(removedinCXF3)-Usinganamedreplydestination">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 <code>jndiReplyDestinationName</code> 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 <code>ReplyTo</code> field of all outgoing requests. A service endpoint will use the value of the <code>jndiReplyDestinationName</code> attribute as the location for placing replies if there is no destination specified in the request's <code>ReplyTo</code> field.</p><p>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.</p><p>The following example shows an example of a JMS WSDL port specification.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JMS WSDL Port Specification</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;service name="JMSService"&gt;
&lt;port binding="tns:Greeter_SOAPBinding" name="SoapPort"&gt;
&lt;jms:address jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicQueues/test.cxf.jmstransport"&gt;
&lt;jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" /&gt;
&lt;jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61616" /&gt;
&lt;/jms:address&gt;
&lt;/port&gt;
&lt;/service&gt;
</pre>
</div></div><h3 id="CXF2.xJMSconfiguration(removedinCXF3)-UsingConfiguration">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 id="CXF2.xJMSconfiguration(removedinCXF3)-Configurationelements">Configuration elements</h4><p>You configure a JMS endpoint using one of the following configuration elements:</p><ul><li><p><strong><a shape="rect" class="external-link" href="http://jmsconduit" rel="nofollow">jms:conduit</a></strong>:&#160;The <code><a shape="rect" class="external-link" href="http://jmsconduit" rel="nofollow">jms:conduit</a></code> element contains the configuration for a consumer endpoint. It has one attribute, <code>name</code>, whose value takes the form</p><div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>{WSDLNamespace}WSDLPortName.jms-conduit
</pre>
</div></div><p>.</p></li><li><p><strong><a shape="rect" class="external-link" href="http://jmsdestination" rel="nofollow">jms:destination</a></strong>:&#160;The <code><a shape="rect" class="external-link" href="http://jmsdestination" rel="nofollow">jms:destination</a></code> element contains the configuration for a provider endpoint. It has one attribute, <code>name</code>, whose value takes the form</p><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 id="CXF2.xJMSconfiguration(removedinCXF3)-Theaddresselement.1">The <code>address</code> element</h4><p>JMS connection information is specified by adding a <code><a shape="rect" class="external-link" href="http://jmsaddress" rel="nofollow">jms:address</a></code> child to the base configuration element. The <code><a shape="rect" class="external-link" href="http://jmsaddress" rel="nofollow">jms:address</a></code> element used in the configuration file is identical to the one used in the WSDL file. Its attributes are listed in the <a shape="rect" href="cxf-2x-jms-configuration-removed-in-cxf-3.html">address element's attribute table</a>. Like the <a shape="rect" class="external-link" href="http://jmsaddress" rel="nofollow">jms:address</a> element in the WSDL file, the <a shape="rect" class="external-link" href="http://jmsaddress" rel="nofollow">jms:address</a> configuration element also has a <code>jms:JMSNamingProperties</code> child element that is used to specify additional information used to connect to a JNDI provider.</p><h4 id="CXF2.xJMSconfiguration(removedinCXF3)-Example">Example</h4><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Addressing Information a Configuration File</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ct="http://cxf.apache.org/configuration/types"
xmlns:jms="http://cxf.apache.org/transports/jms"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd"&gt;
&lt;jms:conduit name="{http://cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-conduit"&gt;
&lt;jms:address destinationStyle="queue"
jndiConnectionFactoryName="myConnectionFactory"
jndiDestinationName="myDestination"
jndiReplyDestinationName="myReplyDestination"
connectionUserName="testUser"
connectionPassword="testPassword"&gt;
&lt;jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.cxf.transport.jms.MyInitialContextFactory"/&gt;
&lt;jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61616"/&gt;
&lt;/jms:address&gt;
&lt;/jms:conduit&gt;
&lt;/beans&gt;
</pre>
</div></div><h3 id="CXF2.xJMSconfiguration(removedinCXF3)-ConsumerEndpointConfiguration">Consumer Endpoint Configuration</h3><p>JMS consumer endpoints specify the type of messages they use. JMS consumer endpoint can use either a JMS <code>ObjectMessage</code> or a JMS <code>TextMessage</code>. When using an <code>ObjectMessage</code> the consumer endpoint uses a <code>byte[]</code> 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 <code>byte[]</code> 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 <code>byte[]</code>.</p><p>When using a <code>TextMessage</code>, 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 <code>TextMessage</code>, 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 id="CXF2.xJMSconfiguration(removedinCXF3)-UsingConfiguration.1">Using Configuration</h3><h4 id="CXF2.xJMSconfiguration(removedinCXF3)-Specifyingthemessagetype">Specifying the message type</h4><p>You can specify the message type supported by the consumer endpoint using a <code><a shape="rect" class="external-link" href="http://jmsruntimePolicy" rel="nofollow">jms:runtimePolicy</a></code> element that has a single attribute:</p><ul><li><code>messageType</code> - Specifies how the message data will be packaged as a JMS message. <code>text</code> specifies that the data will be packaged as a <code>TextMessage</code>. <code>binary</code> specifies that the data will be packaged as an <code>ObjectMessage</code>.</li></ul><p>The following example shows a configuration entry for configuring a JMS consumer endpoint.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Configuration for a JMS Consumer Endpoint</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ct="http://cxf.apache.org/configuration/types"
xmlns:jms="http://cxf.apache.org/transports/jms"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd"
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd"&gt;
...
&lt;jms:conduit name="{http://cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-conduit"&gt;
&lt;jms:address ... &gt;
...
&lt;/jms:address&gt;
&lt;jms:runtimePolicy messageType="binary"/&gt;
...
&lt;/jms:conduit&gt;
...
&lt;/beans&gt;
</pre>
</div></div><p>The id on the <code><a shape="rect" class="external-link" href="http://jmsconduit" rel="nofollow">jms:conduit</a></code> is in the form of {<code><em>WSDLNamespace</em>}<em>WSDLPortName</em>.jms-conduit</code>. This provides CXF with the information so that it can associate the configuration with your service's endpoint.</p><h3 id="CXF2.xJMSconfiguration(removedinCXF3)-UsingWSDL.1">Using WSDL</h3><p>The type of messages accepted by a JMS consumer endpoint is configured using the optional <code><a shape="rect" class="external-link" href="http://jmsclient" rel="nofollow">jms:client</a></code> element. The <code><a shape="rect" class="external-link" href="http://jmsclient" rel="nofollow">jms:client</a></code> element is a child of the WSDL port element and has one attribute:</p><ul><li><code>messageType</code> - Specifies how the message data will be packaged as a JMS message. <code>text</code> specifies that the data will be packaged as a <code>TextMessage</code>. <code>binary</code> specifies that the data will be packaged as an ObjectMessage.</li></ul><h2 id="CXF2.xJMSconfiguration(removedinCXF3)-ServiceEndpointConfiguration">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 id="CXF2.xJMSconfiguration(removedinCXF3)-UsingConfiguration.2">Using Configuration</h3><h4 id="CXF2.xJMSconfiguration(removedinCXF3)-Specifyingconfigurationdata">Specifying configuration data</h4><p>Using the <code><a shape="rect" class="external-link" href="http://jmsdestination" rel="nofollow">jms:destination</a></code> elements you can configure your service's endpoint. You can specify the service endpoint's behaviors using the <code><a shape="rect" class="external-link" href="http://jmsruntimePolicy" rel="nofollow">jms:runtimePolicy</a></code> element that has a the following attributes:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>useMessageIDAsCorrealationID</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether the JMS broker will use the message ID to correlate messages. The default is <code>false</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>durableSubscriberName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the name used to register a durable subscription.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>messageSelector</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the string value of a message selector to use. For more information on the syntax used to specify message <br clear="none" class="atl-forced-newline"> selectors, see the JMS 1.1 specification.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>transactional</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether the local JMS broker will create transactions around message processing. The default is <code>false</code>.</p></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 pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Configuration for a JMS Service Endpoint</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ct="http://cxf.apache.org/configuration/types"
xmlns:jms="http://cxf.apache.org/transports/jms"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd"
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd"&gt;
...
&lt;jms:destination name="{http://cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-destination"&gt;
&lt;jms:address ... &gt;
...
&lt;/jms:address&gt;
...
&lt;jms:runtimePolicy messageSelector="cxf_message_selector"
useMessageIDAsCorrelationID="true"
transactional="true"
durableSubscriberName="cxf_subscriber" /&gt;
...
&lt;/jms:destination&gt;
...
&lt;/beans&gt;
</pre>
</div></div><h3 id="CXF2.xJMSconfiguration(removedinCXF3)-UsingWSDL.2">Using WSDL</h3><p>Service endpoint behaviors are configured using the optional <code><a shape="rect" class="external-link" href="http://jmsserver" rel="nofollow">jms:server</a></code> element. The <code><a shape="rect" class="external-link" href="http://jmsserver" rel="nofollow">jms:server</a></code> element is a child of the WSDL <code>port</code> element and has the following attributes:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>useMessageIDAsCorrealationID</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether JMS will use the message ID to correlate messages. The default is <code>false</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>durableSubscriberName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the name used to register a durable subscription.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>messageSelector</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the string value of a message selector to use. For more information on the syntax used to specify message <br clear="none" class="atl-forced-newline"> selectors, see the JMS 1.1 specification.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>transactional</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether the local JMS broker will create transactions around message processing. The default is <code>false</code>. Currently, this is not supported by the runtime.</p></td></tr></tbody></table></div><h2 id="CXF2.xJMSconfiguration(removedinCXF3)-JMSRuntimeConfiguration">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 id="CXF2.xJMSconfiguration(removedinCXF3)-SessionPoolConfiguration">Session Pool Configuration</h3><p>You configure an endpoint's JMS session pool using the <code><a shape="rect" class="external-link" href="http://jmssessionPoolConfig" rel="nofollow">jms:sessionPoolConfig</a></code> 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 clear="none"> The <code><a shape="rect" class="external-link" href="http://jmssessionPool" rel="nofollow">jms:sessionPool</a></code> 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 colspan="1" rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>lowWaterMark</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the minimum number of JMS sessions pooled by the endpoint. The default is 20.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>highWaterMark</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the maximum number of JMS sessions pooled by the endpoint. The default is 500.</p></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 pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JMS Session Pool Configuration</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;jms:destination
name="{http://cxf.apache.org/jms_endpit}HelloWorldJMSPort.jms-destination"&gt;
...
&lt;jms:sessionPool lowWaterMark="10" highWaterMark="5000" /&gt;
&lt;/jms:destination&gt;
</pre>
</div></div><p>The <code><a shape="rect" class="external-link" href="http://jmssessionPool" rel="nofollow">jms:sessionPool</a></code> element can also be used within a <code><a shape="rect" class="external-link" href="http://jmsconduit" rel="nofollow">jms:conduit</a></code>.</p><h3 id="CXF2.xJMSconfiguration(removedinCXF3)-ConsumerSpecificRuntimeConfiguration">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 <code><a shape="rect" class="external-link" href="http://jmsclientConfig" rel="nofollow">jms:clientConfig</a></code> 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 colspan="1" rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>clientReceiveTimeout</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>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.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>messageTimeToLive</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>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.</p></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 pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JMS Consumer Endpoint Runtime Configuration</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;jms:conduit name="{http://cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-conduit"&gt;
...
&lt;jms:clientConfig clientReceiveTimeout="500"
messageTimeToLive="500" /&gt;
&lt;/jms:conduit&gt;
</pre>
</div></div><h3 id="CXF2.xJMSconfiguration(removedinCXF3)-ServiceSpecificRuntimeConfiguration">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 <code><a shape="rect" class="external-link" href="http://jmsserverConfig" rel="nofollow">jms:serverConfig</a></code> 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 colspan="1" rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>messageTimeToLive</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>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.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>durableSubscriptionClientId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the client identifier the endpoint uses to create and access durable subscriptions.</p></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 <code>jms-test-id</code>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JMS Service Endpoint Runtime Configuration</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;jms:destination id="{http://cxf.apache.org/jms_endpt}HelloWorldJMSPort.jms-destination"&gt;
&lt;jms:address ... &gt;
...
&lt;/jms:address&gt;
&lt;jms:serverConfig messageTimeToLive="500"
durableSubscriptionClientId="jms-test-id" /&gt;
&lt;/jms:destination&gt;
</pre>
</div></div></div>
</div>
<!-- Content -->
</td>
</tr>
</table>
</td>
<td id="cell-2-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-3-0">&nbsp;</td>
<td id="cell-3-1">&nbsp;</td>
<td id="cell-3-2">
<div id="footer">
<!-- Footer -->
<div id="site-footer">
<a href="http://cxf.apache.org/privacy-policy.html">Privacy Policy</a> -
(<a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=40508913">edit page</a>)
(<a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=40508913&amp;showComments=true&amp;showCommentArea=true#addcomment">add comment</a>)<br>
Apache CXF, CXF, Apache, the Apache feather logo are trademarks of The Apache Software Foundation.<br>
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
</div>
<!-- Footer -->
</div>
</td>
<td id="cell-3-3">&nbsp;</td>
<td id="cell-3-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-4-0" colspan="2">&nbsp;</td>
<td id="cell-4-1">&nbsp;</td>
<td id="cell-4-2" colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-4458903-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>