I have a CXF configuration (in applicationContext.xml) that talks to
IBM MQ via JNDI resources.
I'd like to use this cxf-configured message queue as a Camel destination.
I'm stuck on the difference between
org.apache.cxf.transport.jms.JMSConfiguration and
org.apache.camel.component.jms.JmsConfiguration,
and whether I can convince Camel to talk to my cxf-configured message queue.
<!-- Here's what I'd like to do with camel: -->
<route>
<from uri="direct:example"/>
<to uri="ibmmq://targetDestination" /> <!-- where this queue is
configured with a org.apache.cxf.transport.jms.JMSConfiguration -->
</route>
<!-- ... using camel and pre-existing cxf config ? -->
<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
<!-- Obviously this isn't right because jmsConfig is a
org.apache.cxf.transport.jms.JMSConfiguration . . .
but maybe something similar is possible? -->
<property name="configuration" ref="jmsConfig"/>
</bean>
<!-- And here's my pre-existing CXF configuration, which works, and
I'd like to keep as-is -->
<bean id="myConnectionFactory"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory"
ref="myTargetConnectionFactory"/>
<property name="username" value="My_UserName"/>
<property name="password" value="My_Password"/>
</bean>
<bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
<property name="targetDestination" value="jms/My_Target_Queue"/>
<!-- (won't actually need response queue for camel) -->
<property name="replyDestination" value="jms/My_Response_Queue"/>
<property name="connectionFactory" ref="myConnectionFactory" />
<property name="wrapInSingleConnectionFactory" value="false" />
<!-- NOTE: 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. -->
<property name="destinationResolver" ref="jmsDestResolver" />
<!-- NOTE: set to false to avoid:
"IllegalStateException: Method setExceptionListener not permitted;
nested exception is javax.jms.IllegalStateException:
Method setExceptionListener not permitted". -->
<property name="reconnectOnException" value="false"/>
<property name="useJms11" value="true" />
<!-- NOTE: false means use queues, true means use topics -->
<property name="pubSubDomain" value="false"/>
<property name="concurrentConsumers" value="1" />
<property name="maxConcurrentConsumers" value="10" />
<!-- NOTE: We cannot use sessionTransacted=true without "Last
Participant Support Extension" support. Setting this to false
means that JMS Messages are *always* read and acknowledged as
successful regardless of processing in onMessage(). -->
<property name="sessionTransacted" value="false" />
<!-- NOTE: If we try to use a cache without a transactionManager we
get "Connection closed" errors -->
<property name="cacheLevelName" value="CACHE_NONE" />
</bean>
<jee:jndi-lookup id="myTargetConnectionFactory"
jndi-name="jms/MY_CONNECTION_FACTORY"/>
<bean id="jmsDestResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver"/>