You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sergarci <se...@gmail.com> on 2014/05/27 15:47:46 UTC
Camel jsm via jndi example
Hi
I've just made an endpoint with jsm using weblogic jndi.
Here is the example:
the jms-setup.xml file is like:
<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="jndiTemplate"
class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop
key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
<prop
key="java.naming.provider.url">t3://serverIP:serverPORT</prop>
<prop
key="java.naming.security.principal">username</prop>
<prop
key="java.naming.security.credentials">password</prop>
</props>
</property>
</bean>
<bean id="jndiFactoryBean"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"
value="javax/jms/QueueConnectionFactory"/>
<property name="jndiTemplate" ref="jndiTemplate"/>
</bean>
<bean id="jndiDestinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate" ref="jndiTemplate"/>
</bean>
<bean id="jmsConfiguration"
class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jndiFactoryBean"/>
<property name="destinationResolver"
ref="jndiDestinationResolver"/>
</bean>
<bean id="jmsPublisher"
class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="jmsConfiguration" />
</bean>
</beans>
in camel-context.xml we add:
<to uri="jmsPublisher:queue:dbus/jms/queue/QUEUE_NAME"/>
I hope it will be helpful.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-jsm-via-jndi-example-tp5751623.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel jsm via jndi example
Posted by sergarci <se...@gmail.com>.
[UPDATE]
if the queue needs user and password:
<to
uri="jmsPublisher:queue:{{jms.queue.name}}?username={{jms.destination.user}}&password={{jms.destination.password}}"/>
For a topic:
<to
uri="jmsPublisher:topic:{{jms.topic.name}}?username={{jms.destination.user}}&password={{jms.destination.password}}"/>
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-jms-via-jndi-example-tp5751623p5753997.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel jsm via jndi example
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Thanks for sharing this.
If you want to share you example in our cookbook, then you are welcome
to log a JIRA ticket and attach it as a .txt file etc. Then we can add
it to the docs
http://camel.apache.org/cookbook
On Tue, May 27, 2014 at 3:47 PM, sergarci <se...@gmail.com> wrote:
> Hi
>
> I've just made an endpoint with jsm using weblogic jndi.
> Here is the example:
> the jms-setup.xml file is like:
>
> <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="jndiTemplate"
> class="org.springframework.jndi.JndiTemplate">
> <property name="environment">
> <props>
> <prop
> key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
> <prop
> key="java.naming.provider.url">t3://serverIP:serverPORT</prop>
> <prop
> key="java.naming.security.principal">username</prop>
> <prop
> key="java.naming.security.credentials">password</prop>
> </props>
> </property>
> </bean>
>
> <bean id="jndiFactoryBean"
> class="org.springframework.jndi.JndiObjectFactoryBean">
> <property name="jndiName"
> value="javax/jms/QueueConnectionFactory"/>
> <property name="jndiTemplate" ref="jndiTemplate"/>
> </bean>
>
> <bean id="jndiDestinationResolver"
> class="org.springframework.jms.support.destination.JndiDestinationResolver">
> <property name="jndiTemplate" ref="jndiTemplate"/>
> </bean>
>
> <bean id="jmsConfiguration"
> class="org.apache.camel.component.jms.JmsConfiguration">
> <property name="connectionFactory" ref="jndiFactoryBean"/>
> <property name="destinationResolver"
> ref="jndiDestinationResolver"/>
> </bean>
>
> <bean id="jmsPublisher"
> class="org.apache.camel.component.jms.JmsComponent">
> <property name="configuration" ref="jmsConfiguration" />
> </bean>
>
> </beans>
>
> in camel-context.xml we add:
>
> <to uri="jmsPublisher:queue:dbus/jms/queue/QUEUE_NAME"/>
>
> I hope it will be helpful.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-jsm-via-jndi-example-tp5751623.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/