yryrp
yryrp

Reputation: 37

how to let differents endpoints use differents JmsComponents in camel?

suppose I have this code :

<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
 <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
 <property name="connectionFactory">
 <bean class="org.apache.activemq.ActiveMQConnectionFactory">
 <property name="brokerURL" value="vm://localhost" />
 </bean>
 </property>
 </bean>
</beans>

<routeContext id="ftpToJms1" xmlns="http://camel.apache.org/schema/spring">
 <route>
 <from uri="ftp://rider.com/orders?username=rider&password=secret"/>
 <to uri="jms:incomingOrders1"/>
 </route>
</routeContext>
<routeContext id="ftpToJms2" xmlns="http://camel.apache.org/schema/spring">
 <route>
 <from uri="ftp://rider.com/orders?username=rider&password=secret"/>
 <to uri="jms:incomingOrders2"/>
 </route>
</routeContext>

<camelContext xmlns="http://camel.apache.org/schema/spring">
 <routeContextRef ref="ftpToJms1"/>
 <routeContextRef ref="ftpToJms2"/>
</camelContext>

and I want that ftpToJms1 and ftpToJms2 will use differents JmsComponents (I want to add one more JmsComponen), how can I do it ?

Upvotes: 1

Views: 183

Answers (1)

Christian Schneider
Christian Schneider

Reputation: 19606

When you define

<bean id="jms2" class="org.apache.camel.component.jms.JmsComponent">...
</bean>

then the id "jms2" is the name of the jms component. Just give this id a different name for the second jms component like above.

Then you can refer to it like:

<to uri="jms2:incomingOrders2"/>

Upvotes: 1

Related Questions