[jboss-user] [Messaging, JMS & JBossMQ] - Getting a JMS producer to send to remote queue
krimsonnitehawk
do-not-reply at jboss.com
Wed Feb 28 10:31:35 EST 2007
Hi,
I have a local InitialContext() and have used this to create a local QueueConnection, QueueSession, and local consumer(QueueReceiver) to receive messages on a local receive Queue. My local producer(QueueSender) is to send to a remote destination but the jndi lookup is failing as (I think) the jndi name has no information about the location of the remote server.
My code is this:
QueueSender sender = localQueueSession.createSender(remoteQueue);
And I get the error:
(javax.jms.InvalidDestinationException: This destination does not exist! QUEUE.remotequeuename)
The remoteQueue is created using a correctly configured remoteIntialContext() different to my local initialContext(). From that remoteInitialContext() I created a remote QueueConnection, QueueSession and used the remoteInitialContext() to lookup() the remote destination(queue), which I pass to the LOCAL producer.
The only way I can get it to work is to do this:
QueueSender sender = remoteQueueSession.createSender(remoteQueue);
but as far as my understanding goes that is creating a producer on the remote server, not the local server. Then to send the message I first create the message remotely,
ObjectMessage om = remoteQueueSession.createObjectMessage(message);
and then:
sender.send(om);
which sends the message to the remote destination (remoteQueue) which pops my MDB.
I may be wrong but this seems like the wrong way to do it(all remotely) as the local producer must surely be able to send to a remote destination.
Any help would be much appreciated!
Andy
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4023753#4023753
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4023753
More information about the jboss-user
mailing list