Standard JMS transport configuration in CXF is done by defining a JMSConduit or JMSDestination. There is however an easier configuration option more conformant to Spring dependency injection. Additionally the new configuration offers many 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 configuration.
The following example configs use the p-namespace from spring 2.5 but the old spring bean style is also possible.
Inside a features element the JMSConfigFeature can be defined.
In the above example it references a bean "jmsConfig" where the whole configuration for the JMS transport can be done.
A jaxws Endpoint can be defined in the same way:
The JMSConfiguration bean needs at least a reference to a conncection factory and a target destination.
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.
Using JMSConfiguration from Java
To do this from Java, you need to initialize a JMSConfiguration object, then store a reference to it in a JMSConfigFeature, and then add that to the features in the server factory. The code that follows is fragmentary. Note that you can't use query parameters in the endpoint URI that you set in the server factory, all the configuration has to be in the JMSConfiguration object.
Mandatory field. Reference to a bean that defines a jms ConnectionFactory. Remember to wrap the connectionFactory like described above when not using a pooling ConnectionFactory
Will wrap the connectionFactory with a Spring SingleConnectionFactory, which can improve the performance of the jms transport. Default is true.
If wrapping the connectionFactory with a Spring SingleConnectionFactory and reconnectOnException is true, will create a new connection if there is an exception thrown, otherwise will not try to reconnect if the there is an exception thrown. Default is false.
JNDI name or provider specific name of a destination. Example for ActiveMQ:
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.
Reference to a spring transaction manager. This allows to take part in JTA Transactions with your webservice.
Reference to a spring TaskExecutor. This is used in listeners to decide how to handle incoming messages. Default is a spring SimpleAsyncTaskExecutor.
true means JMS 1.1 features are used
false means only JMS 1.0.2 features are used. Default is false.
Default is true.
Default is true.
Specify the level of caching that the JMS listener container is allowed to apply.
Please check out the java doc of the org.springframework.jms.listenerDefaultMessageListenerContainer for more information. Default is -1.
If true, do not receive your own messages when using topics. Default is false.
How many milliseconds to wait for response messages. 0 (default) means wait indefinitely.
If true, means that QoS parameters are set for each message. Default is false.
NON_PERSISTENT = 1 (default) messages will be kept only in memory
PERSISTENT = 2 messages will be persisted to disk
Priority for the messages. Default is 4. See your JMS provider doc for details
After this time the message will be discarded by the jms provider (default 0).
If true, means JMS transactions are used. (Default is false).
Minimum number of concurrent consumers for listener (default 1).
Maximum number of concurrent consumers for listener (default 1).
(deprecated) Maximum number of threads that handle the received requests (Default 10).
jms selector to filter incoming messages (allows to share a queue)
false (default) means use queues
true means use topics
true means that the jms provider is Tibco EMS. Default is false. Currently this activates that the principal in the SecurityContext is populated from the header JMS_TIBCO_SENDER. (available from cxf version 2.2.6)