The JMS destination information is provided using the jms:address
element and its child, the jms:JMSNamingProperties
element. The
jms:address
element's attributes specify the information needed to identify
the JMS broker and the destination. The jms:JMSNamingProperties
element
specifies the Java properties used to connect to the JNDI service.
The basic configuration for a JMS endpoint is done by using a jms:address
element as the child of your service's port
element. The
jms:address
element uses the attributes described below to configure the
connection to the JMS broker.
Attribute |
Description |
---|---|
|
Specifies if the JMS destination is a JMS queue or a JMS topic. |
|
Specifies the JNDI name bound to the JMS connection factory to use when connecting to the JMS destination. |
|
Specifies the JNDI name bound to the JMS destination to which requests are sent. |
|
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. |
|
Specifies the username to use when connecting to a JMS broker. |
|
Specifies the password to use when connecting to a JMS broker. |
To increase interoperability with JMS and JNDI providers, the
jms:address
element has a child element,
jms:JMSNamingProperties
, that allows you to specify the values used to
populate the properties used when connecting to the JNDI provider. The
jms:JMSNamingProperties
element has two attributes: name
and
value
. The name
attribute specifies the name of the property
to set. The value
attribute specifies the value for the specified property.
The jms:JMSNamingProperties
element can also be used for specification of
provider specific properties. The following is a list of common JNDI
properties that can be set:
-
java.naming.factory.initial
-
java.naming.provider.url
-
java.naming.factory.object
-
java.naming.factory.state
-
java.naming.factory.url.pkgs
-
java.naming.dns.url
-
java.naming.authoritative
-
java.naming.batchsize
-
java.naming.referral
-
java.naming.security.protocol
-
java.naming.security.authentication
-
java.naming.security.principal
-
java.naming.security.credentials
-
java.naming.language
-
java.naming.applet
For more details on what information to use in these attributes, check your JNDI provider's documentation and consult the Java API reference material.
By default, CXF endpoints using JMS create a temporary queue for sending replies back
and forth. You can change this behavior by setting the
jndiReplyDestinationName
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 ReplyTo
field of all outgoing requests. A
service endpoint will use the value of the jndiReplyDestinationName
attribute
as the location for placing replies if there is no destination specified in the request's
ReplyTo
field.
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.
The following example shows an example of a JMS WSDL port specification.
JMS WSDL Port Specification
<service name="JMSService">
<port binding="tns:Greeter_SOAPBinding" name="SoapPort">
<jms:address jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicQueues/test.cxf.jmstransport">
<jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
<jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61616" />
</jms:address>
</port>
</service>