subscribing to JMS queue on a different server ?

G

gabriel

Greetings

I got the following thing :
A tomcat (A) with a servlet which needs to subscribe to a queue held in
JBoss server (B) situated on another point of the network (say on the
same lan).
I can do it if tomcat would hold both servlet and JMS but I do not know
how if it's on separate servers or machines...

My question is : how can I do this ?

many thx if someone has some tips :)
 
R

Robert kebernet Cooper

I have never worked with JBoss, but you can use the JNDI stuff in your
web.xml file thusly:

<jndi-link>
<jndi-name>java:comp/env/jms-local</jndi-name>

<jndi-factory>com.swiftmq.jndi.InitialContextFactoryImpl</jndi-factory>
<init-param
java.naming.provider.url="smqp://localhost:4001/timeout=10000"/>
</jndi-link>
<jndi-link>
<jndi-name>java:comp/env/jms-remote</jndi-name>

<jndi-factory>com.swiftmq.jndi.InitialContextFactoryImpl</jndi-factory>
<init-param
java.naming.provider.url="smqp://other-server.mydomain.tld:4001/timeout=10000"/>
</jndi-link>

then do a (new InitialContext()).lookup( "java:comp/env/jms-remote");
out of the servlet.
I am sure JBoss has some similar factory and provider URL format.
 
G

gabriel

Robert said:
I have never worked with JBoss, but you can use the JNDI stuff in your
web.xml file thusly:

<jndi-link>
<jndi-name>java:comp/env/jms-local</jndi-name>

<jndi-factory>com.swiftmq.jndi.InitialContextFactoryImpl</jndi-factory>
<init-param
java.naming.provider.url="smqp://localhost:4001/timeout=10000"/>
</jndi-link>
<jndi-link>
<jndi-name>java:comp/env/jms-remote</jndi-name>

<jndi-factory>com.swiftmq.jndi.InitialContextFactoryImpl</jndi-factory>
<init-param
java.naming.provider.url="smqp://other-server.mydomain.tld:4001/timeout=10000"/>
</jndi-link>

then do a (new InitialContext()).lookup( "java:comp/env/jms-remote");
out of the servlet.
I am sure JBoss has some similar factory and provider URL format.
ok that's it :

I declare my jndi call in my tomcat app with a reference to jboss server.

Thank you very much for your quick answer :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top