|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Connection to remote queue using JMS and JNDI |
« View previous topic :: View next topic » |
Author |
Message
|
psymmtw |
Posted: Wed May 30, 2012 9:40 am Post subject: Connection to remote queue using JMS and JNDI |
|
|
Newbie
Joined: 30 May 2012 Posts: 3
|
Hi,
Sorry if the the answer is blindingly obvious, but it has stumpt me all day.
I have the following setup
MACHINE A:
Hostname: machineA
JMS client application (WSO2 ESB to be exact)
Websphere MQ 6 client
MACHINE B:
Hostname: machineB
Websphere MQ 6 Server
Queue Manager - Name: MSOLU05
Queue - Name: "REQUEST.QUEUE"
Port: 1410
From the client application on machine A, I'd like to be able to connect to the queue manager on Machine B and pull messages from the queue "REQUEST.QUEUE". That seems fairly easy if using a non-JNDI setup. However, the application program only supports retriving the JMS factories and settings via JNDI. The problem I'm trying to figure out is how to publish the details of the queue via JNDI, so that the queue can be accessed remotely.
I've looked at the JMSAdmin tool, and created a connection factory,
Code: |
DEFINE QCF(QueueConnectionFactory) QMGR(MSOLU05) HOST(machineB) PORT(1410) TRANSPORT(CLIENT) |
However, when it comes to publishing the queue details, I'm not sure how to specify that it is a remote queue. I've entered the below into the JMSAdmin
Code: |
DEFINE Q(TestQueue) QMGR(MSOLU05) QUEUE(REQUEST.QUEUE) |
I originally thought that I could just add TRANSPORT, PORT and HOST to this line, but according to the IBM documentation, non of these properties are supported by the Q object. So I'm left scratching my head has to how to connect via JMS using JNDI to a remote MQ queue. If someone could point me in the right direction, that would be most appreciated. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed May 30, 2012 9:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So JNDI acts as a holder of information.
You configure the InitialContextFactory to know how to connect to the JNDI that holds the relevant information that you need.
You then ask for a QueueConnectionFactory from the JNDI by the name that was used to define it.
JMSAdmin is a tool that can be used to populate a JNDI. In order for it to be successful, it must be configured to know how to connect to the JNDI you want to use.
I suspect you will find that by default, it uses a file based initial context. You can then take this file, and provide it to the JMS application, and instruct the JMS Application on how to configure it's InitialContext to use this file and the file based initial context. |
|
Back to top |
|
 |
psymmtw |
Posted: Thu May 31, 2012 1:26 am Post subject: |
|
|
Newbie
Joined: 30 May 2012 Posts: 3
|
I have already connected the JMS client app to the JNDI repository.
The problem I'm having is how to correctly define the Q object in JMSAdmin so that the client app will know that the queue is a remote queue on machineB.
All the examples in the IBM documentation and the ones I can find on the web are all cases where the JMS client is running on the same host as the Websphere MQ queue (i.e. connecting to a local queue). |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 31, 2012 1:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You don't tell the client app that the queue is a remote queue.
You merely tell it the name of the queue. The queue manager the app is connected to will know that it is a remote queue from that queue manager, and know how to send it data.
You do not need to specify anything in the QMGR on the Q definition parameter, unless your mq administrator tells you to.
And remember - No MQ application can READ messages from queues that are not QLOCALS on the queue manager they are connected to.
You only need connection information - host, channel, port, to identify how to find the queue manager you want to connect to. Once you've connected, MQ handles all of the network details for you, you only use Queue name and sometimes queue manager name to address messages. |
|
Back to top |
|
 |
psymmtw |
Posted: Thu May 31, 2012 1:57 am Post subject: |
|
|
Newbie
Joined: 30 May 2012 Posts: 3
|
Thanks for the explaination. That makes things a lot clearer. Much appreciated. |
|
Back to top |
|
 |
akidase |
Posted: Fri Oct 26, 2012 1:50 pm Post subject: |
|
|
Centurion
Joined: 10 Jan 2011 Posts: 124
|
Quote: |
I have already connected the JMS client app to the JNDI repository.
|
Please let me know, how you accomplished it ?
Was it Broker (JMS Node ) or Java program or.. ? |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|