You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gabriel Soto <ga...@gmail.com> on 2016/06/14 22:46:17 UTC
Connecting to multiple JMS providers
Hello,
We need to connect to two different JMS providers in two different
application containers:
1. A remote MQ running on WebSphere
2. A local WebSphere using the native JMS implementation
We are using Spring-only configuration.
I managed to properly connect to both containers individually but I don't
know how to configure the two connections at the same time, since there is
only one JMS component.
How should I approach this task? Is there a way to set up two different JMS
components and use distinguishable endpoint URIs to reference them?
My current configuration looks something like this (both factories work
alternatively):
<bean id="JmsComponent" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="JmsConnectionFactory"/>
</bean>
<bean id="JmsConnectionFactory"
class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="1"/>
<property name="hostName" value="..."/>
<property name="port" value="..."/>
<property name="queueManager" value="..."/>
</bean>
<jee:jndi-lookup id="JmsConnectionFactory2"
jndi-name="jms/QueueConnectionFactory" lookup-on-startup="true"
proxy-interface="javax.jms.QueueConnectionFactory">
<jee:environment>
java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory
java.naming.provider.url=iiop://...
java.naming.security.authentication=simple
java.naming.security.principal=...
java.naming.security.credentials=...
</jee:environment>
</jee:jndi-lookup>
Thank you,
Gabriel
Re: Connecting to multiple JMS providers
Posted by Gabriel Soto <ga...@gmail.com>.
That was surprisingly easy.
For some reason I missed that in the docs, but it is here:
http://camel.apache.org/how-do-i-configure-endpoints.html#HowdoIconfigureendpoints-UsingSpringXML
Thank you!
Gabriel
On Wed, Jun 15, 2016 at 12:18 AM, Matt Sicker <bo...@gmail.com> wrote:
> You can create two JmsComponent beans and use the id of the bean as the
> scheme in the URI. So you could have something like mqremote:queueName and
> mqlocal:queueName if you gave the beans IDs of mqremote and mqlocal
> respectively.
>
> On 14 June 2016 at 17:46, Gabriel Soto <ga...@gmail.com> wrote:
>
> > Hello,
> >
> > We need to connect to two different JMS providers in two different
> > application containers:
> >
> > 1. A remote MQ running on WebSphere
> > 2. A local WebSphere using the native JMS implementation
> >
> > We are using Spring-only configuration.
> > I managed to properly connect to both containers individually but I don't
> > know how to configure the two connections at the same time, since there
> is
> > only one JMS component.
> > How should I approach this task? Is there a way to set up two different
> JMS
> > components and use distinguishable endpoint URIs to reference them?
> >
> > My current configuration looks something like this (both factories work
> > alternatively):
> >
> > <bean id="JmsComponent"
> > class="org.apache.camel.component.jms.JmsComponent">
> > <property name="connectionFactory" ref="JmsConnectionFactory"/>
> > </bean>
> >
> > <bean id="JmsConnectionFactory"
> > class="com.ibm.mq.jms.MQQueueConnectionFactory">
> > <property name="transportType" value="1"/>
> > <property name="hostName" value="..."/>
> > <property name="port" value="..."/>
> > <property name="queueManager" value="..."/>
> > </bean>
> >
> > <jee:jndi-lookup id="JmsConnectionFactory2"
> > jndi-name="jms/QueueConnectionFactory" lookup-on-startup="true"
> > proxy-interface="javax.jms.QueueConnectionFactory">
> > <jee:environment>
> >
> >
> >
> java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory
> > java.naming.provider.url=iiop://...
> > java.naming.security.authentication=simple
> > java.naming.security.principal=...
> > java.naming.security.credentials=...
> > </jee:environment>
> > </jee:jndi-lookup>
> >
> > Thank you,
> > Gabriel
> >
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>
Re: Connecting to multiple JMS providers
Posted by Matt Sicker <bo...@gmail.com>.
You can create two JmsComponent beans and use the id of the bean as the
scheme in the URI. So you could have something like mqremote:queueName and
mqlocal:queueName if you gave the beans IDs of mqremote and mqlocal
respectively.
On 14 June 2016 at 17:46, Gabriel Soto <ga...@gmail.com> wrote:
> Hello,
>
> We need to connect to two different JMS providers in two different
> application containers:
>
> 1. A remote MQ running on WebSphere
> 2. A local WebSphere using the native JMS implementation
>
> We are using Spring-only configuration.
> I managed to properly connect to both containers individually but I don't
> know how to configure the two connections at the same time, since there is
> only one JMS component.
> How should I approach this task? Is there a way to set up two different JMS
> components and use distinguishable endpoint URIs to reference them?
>
> My current configuration looks something like this (both factories work
> alternatively):
>
> <bean id="JmsComponent"
> class="org.apache.camel.component.jms.JmsComponent">
> <property name="connectionFactory" ref="JmsConnectionFactory"/>
> </bean>
>
> <bean id="JmsConnectionFactory"
> class="com.ibm.mq.jms.MQQueueConnectionFactory">
> <property name="transportType" value="1"/>
> <property name="hostName" value="..."/>
> <property name="port" value="..."/>
> <property name="queueManager" value="..."/>
> </bean>
>
> <jee:jndi-lookup id="JmsConnectionFactory2"
> jndi-name="jms/QueueConnectionFactory" lookup-on-startup="true"
> proxy-interface="javax.jms.QueueConnectionFactory">
> <jee:environment>
>
>
> java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory
> java.naming.provider.url=iiop://...
> java.naming.security.authentication=simple
> java.naming.security.principal=...
> java.naming.security.credentials=...
> </jee:environment>
> </jee:jndi-lookup>
>
> Thank you,
> Gabriel
>
--
Matt Sicker <bo...@gmail.com>