remote jms access from ejb

I want to do the following:

Run different applications on several SJSAS 8.1 appserver instances. Send a JMS message from one application in EJB container to a message queue which resides with a different appserver instance on a different machine.

How can this be done?

I know:

1.) how to connect with a Java standalone client to a remote JMS provider via the corresponding appserver (using -Dorg.omg.CORBA.ORBInitialHost=...)

2.) how to lookup a remote ejb from a local ejb context using <ejb-ref> and corbaname:iiop:hostname:port#ejb/EJBName

syntax.

1.) is no option for an appserver because the applications needs local JNDI lookups, too, and must not always be directed to a remote JNDI provider

2.) a similar scheme with <resource-ref> does not seem to work

How can this goal be achieved, then ?

Is there a way to solve this by configuring a local JMS destination to a remote physical destination in the appserver?

[997 byte] By [darat55a] at [2007-11-27 2:26:51]
# 1

If the server holding the JMS Queue stored the QueueConnectionFactory and the Queue in a JNDI context, you could access the remote context by creating a InitialContext pointing there.

You could write something like:

InitialContext ctx = new InitialContext(props);//you have set props before ;)

Object tmp = ctx.lookup("ConnectionFactory");

QueueConnectionFactory qcf = (QueueConnectionFactory)tmp;

QueueConnection conn = qcf.createQueueConnection();

Queue queue = (Queue)ctx.lookup("queue/myQueue");//or similar ;)

QueueSession session = conn.createQueueSession(false, QueueSession.AUTO_AKNOWLEDGE);

conn.start();

QueueSender sender = session.createSender(queue);

TextMessage msg = session.createTextMessage("Hello World");

sender.send(msg);

sender.close();

..etc

mtedonea at 2007-7-12 2:36:49 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...