On Tue, Feb 8, 2011 at 3:02 AM, Christian Schneider
<[email protected]> wrote:
> Hi Jeffrey,
[...]
> So if you only want one source of jms configuration then you best chance is
> to use the camel config. On the other hand you can also have it redundant
> and use properties for each param you want to configure.
>
> Christian
Vielen Dank, Christian.
Taking your advice, I swapped out CXF's
org.apache.cxf.transport.jms.JMSConfiguration for Camel's
org.apache.camel.component.jms.JmsConfiguration.
Because it's hard to tell how much CXF's JMSConfiguration and Camel's
JmsConfiguration have in common, I expected this to be very painful.
But it was surprisingly easy.
I'm posting my config below, because I haven't seen too many examples
of CXF and / or Camel configurations with JNDI.
Here is my applicationContext.xml configuration for Camel to
communicate with a message queue (IBM MQ) via resources defined in
WebSphere.
Would it be helpful to have this rolled up into a sample for the Camel
distribution since almost all examples that ship with Camel are
examples of direct connection to ActiveMQ rather than via JNDI
resources (e.g. WebSphere) ?
<beans ...>
<camelContext xmlns="http://camel.apache.org/schema/spring">
[... more camel route config here ...]
<route>
<from uri="direct:putModifiedMessageOnQueue"/>
[... some more steps here ...]
<!-- This will output the message in
SystemOut.log - handy for debugging (make sure your log4j has
"myLogger") -->
<to uri="log:myLogger" />
<!-- Note that the queue is the
JNDI-configured name as it appears in WAS. -->
<to uri="ibmmq://queue:jms/My_Jndi_Queue_Name" />
</route>
</camelContext>
<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="jmsConfig"/>
</bean>
<jee:jndi-lookup id="myTargetConnectionFactory"
jndi-name="jms/My_Factory_Jndi_Name"/>
<bean id="jmsDestResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver"/>
<bean id="myConnectionFactory"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory"
ref="myTargetConnectionFactory"/>
<property name="username" value=""/>
<property name="password" value=""/>
</bean>
<!-- Was using CXF jms config:
<bean id="jmsConfig"
class="org.apache.cxf.transport.jms.JMSConfiguration">
but switched to Camel's jms config. Compare:
* http://cxf.apache.org/docs/using-the-jmsconfigfeature.html
with:
* http://camel.apache.org/jms.html
-->
<bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
<!-- The following properties ARE in
org.apache.cxf.transport.jms.JMSConfiguration but NOT in
org.apache.camel.component.jms.JmsConfiguration.
TODO: further research to determine if we really need
any of these!
<property name="wrapInSingleConnectionFactory" value="false" />
<property name="reconnectOnException" value="false"/>
<property name="useJms11" value="true" />
<property name="pubSubDomain" value="false"/>
<property name="sessionTransacted" value="false" />
<property name="targetDestination" value="jms/My_Target_Queue"/>
(The target queue name is taken care of at the route level in Camel)
<property name="replyDestination"
value="jms/My_Response_Queue"/>
(Not reading the response queue, so don't need this)
-->
<property name="connectionFactory" ref="myConnectionFactory" />
<property name="destinationResolver" ref="jmsDestResolver" />
<property name="concurrentConsumers" value="1" />
<property name="maxConcurrentConsumers" value="10" />
<property name="cacheLevelName" value="CACHE_NONE" />
</bean>
</beans>