Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.3.2. JMS URIs
Overview Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
When using SOAP/JMS, a JMS URI is used to specify the endpoint's target destination. The JMS URI can also be used to configure JMS connection by appending one or more options to the URI. These options are detailed in the IETF standard, URI Scheme for Java Message Service 1.0. They can be used to configure the JNDI system, the reply destination, the delivery mode to use, and other JMS properties.
Syntax Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
As shown in Example 3.2, “JMS URI syntax”, you can append one or more options to the end of a JMS URI by separating them from the destination's address with a question mark(
?
). Multiple options are separated by an ampersand(&
). Example 3.4, “Syntax for JMS URI options” shows the syntax for using multiple options in a JMS URI.
Example 3.4. Syntax for JMS URI options
jmsAddress?option1=value1&option2=value2&...optionN=valueN
jmsAddress?option1=value1&option2=value2&...optionN=valueN
JMS properties Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Table 3.2, “JMS properties settable as URI options” shows the URI options that affect the JMS transport layer.
Property | Default | Description |
---|---|---|
deliveryMode | PERSISTENT | Specifies whether to use JMS PERSISTENT or NON_PERSISTENT message semantics. In the case of PERSISTENT delivery mode, the JMS broker stores messages in persistent storage before acknowledging them; whereas NON_PERSISTENT messages are kept in memory only. |
replyToName |
Explicitly specifies the reply destination to appear in the
JMSReplyTo header. Setting this property is recommended for applications that have request-reply semantics because the JMS provider will assign a temporary reply queue if one is not explicitly set.
The value of this property has an interpretation that depends on the variant specified in the JMS URI:
| |
priority | 4 | Specifies the JMS message priority, which ranges from 0 (lowest) to 9 (highest). |
timeToLive | 0 | Time (in milliseconds) after which the message will be discarded by the JMS provider. A value of 0 represents an infinite lifetime (the default). |
JNDI properties Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Table 3.3, “JNDI properties settable as URI options” shows the URI options that can be used to configure JNDI for this endpoint.
Property | Description |
---|---|
jndiConnectionFactoryName | Specifies the JNDI name of the JMS connection factory. |
jndiInitialContextFactory | Specifies the fully qualified Java class name of the JNDI provider (which must be of javax.jms.InitialContextFactory type). Equivalent to setting the java.naming.factory.initial Java system property. |
jndiURL | Specifies the URL that initializes the JNDI provider. Equivalent to setting the java.naming.provider.url Java system property. |
Additional JNDI properties Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
The properties,
java.naming.factory.initial
and java.naming.provider.url
, are standard properties, which are required to initialize any JNDI provider. Sometimes, however, a JNDI provider might support custom properties in addition to the standard ones. In this case, you can set an arbitrary JNDI property by setting a URI option of the form jndi-PropertyName
.
For example, if you were using SUN's LDAP implementation of JNDI, you could set the JNDI property,
java.naming.factory.control
, in a JMS URI as shown in Example 3.5, “Setting a JNDI property in a JMS URI”.
Example 3.5. Setting a JNDI property in a JMS URI
jms:queue:FOO.BAR?jndi-java.naming.factory.control=com.sun.jndi.ldap.ResponseControlFactory
jms:queue:FOO.BAR?jndi-java.naming.factory.control=com.sun.jndi.ldap.ResponseControlFactory
Example Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
If the JMS provider is not already configured, it is possible to provide the requisite JNDI configuration details in the URI using options (see Table 3.3, “JNDI properties settable as URI options”). For example, to configure an endpoint to use the Apache ActiveMQ JMS provider and connect to the queue called
test.cxf.jmstransport.queue
, use the URI shown in Example 3.6, “JMS URI that configures a JNDI connection”.
Example 3.6. JMS URI that configures a JNDI connection
jms:jndi:dynamicQueues/test.cxf.jmstransport.queue ?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory &jndiConnectionFactoryName=ConnectionFactory &jndiURL=tcp://localhost:61616
jms:jndi:dynamicQueues/test.cxf.jmstransport.queue
?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory
&jndiConnectionFactoryName=ConnectionFactory
&jndiURL=tcp://localhost:61616