Author |
Message
|
rajesh.palled |
Posted: Wed Jan 18, 2006 9:28 am Post subject: Server Connection and Client Connection problem!! |
|
|
 Apprentice
Joined: 16 Feb 2004 Posts: 30 Location: New Jersey
|
Hi
I have the Java Code which tries to connect to remote queue managers using the Server Connection.
Well from my code i try to connect to different remote queue managers as well as local queue managers. All the local queue manager as well remote queue managers are in cluster.
My code ALSO has the provision of connecting to these queue managers using the Client Connection type. .i.e. if hostname, port number are given then it tries to connect using the Client Connection otherwise it connect using the bind mode .i.e. Server Connection. I have all these parameters in property file. So if i want to server connection i comment out the hostnmae and port paramters.
Recently what happened is, i wanted to connect to Local Queue Manager as well as Remote Queue Manager from the same application. So i gave the port no, hostname etc.. which are needed for making the connection.
But it did not connect to queue manager and it throws MQRC 2058 error. I am trying to find out can i use the Client Connection as well Server connection in the same application to connect to local as well as Remote queue manager? If yes is there any specifi order or sequence in whcih i need to connect ? like first the client connection and then server connection?
When exactly we use this server connection and client connection channel? As per my understanding "If the Application and Queue Managers are running on the same machine then better to use the Server Connection and if application and QMGR are on different machine then use client connection".
please clarify me if i am wrong!! |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 18, 2006 9:42 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can't make a bindings connection and a client connection inside the same thread.
Your best bet, really, is to make client connections everywhere. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
rajesh.palled |
Posted: Wed Jan 18, 2006 10:31 am Post subject: |
|
|
 Apprentice
Joined: 16 Feb 2004 Posts: 30 Location: New Jersey
|
yes i came to know that we cannot have the Server Connection as well as Client Connection in the same thread. I would like to know what is the reason behind this? how it behaves in the background?
But how about having two threads like for local queue manager connection i will instantiate queue manager and for remote queue manager i will instantiate another connection handle. Will this work in that case? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 18, 2006 10:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You also can't have two server connections in the same thread. I don't know how it works in the background, and it really shouldn't matter to you either.
Yes, you should be fine to put each connection in it's own thread, regardless of whether it's a client or server connection. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
rajesh.palled |
Posted: Wed Jan 18, 2006 11:08 am Post subject: |
|
|
 Apprentice
Joined: 16 Feb 2004 Posts: 30 Location: New Jersey
|
ok Thanks for your answers jefflowrey. Right now i am trying to have these two connections in different thread to try it out. |
|
Back to top |
|
 |
vennela |
Posted: Wed Jan 18, 2006 11:48 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
|
Back to top |
|
 |
rajesh.palled |
Posted: Wed Jan 18, 2006 1:28 pm Post subject: |
|
|
 Apprentice
Joined: 16 Feb 2004 Posts: 30 Location: New Jersey
|
vennela
When you say two different threads in one of your link is it same java program and two different Queue Manager Instantiation right? Just wanted to cross verfy the same. |
|
Back to top |
|
 |
vennela |
Posted: Wed Jan 18, 2006 3:15 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
rajesh.palled wrote: |
is it same java program and two different Queue Manager Instantiation right? Just wanted to cross verfy the same. |
Same Java Program and two different QMGRS |
|
Back to top |
|
 |
rajesh.palled |
Posted: Wed Jan 18, 2006 4:50 pm Post subject: |
|
|
 Apprentice
Joined: 16 Feb 2004 Posts: 30 Location: New Jersey
|
I saw your link http://www.mqseries.net/phpBB2/viewtopic.php?t=13295&highlight=two+qmgrs
where you have two Java Programs. One program connects to two QMGRS with client connection and another program also connects to two QMGRS which uses Binding mode.
What we are trying in our code is same java program two different queue managers and one with client connection and one with binding mode.
Is it possible in this way?? |
|
Back to top |
|
 |
vennela |
Posted: Wed Jan 18, 2006 4:53 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
rajesh.palled wrote: |
What we are trying in our code is same java program two different queue managers and one with client connection and one with binding mode.
Is it possible in this way?? |
What platform?
What MQ Version |
|
Back to top |
|
 |
rajesh.palled |
Posted: Wed Jan 18, 2006 5:10 pm Post subject: |
|
|
 Apprentice
Joined: 16 Feb 2004 Posts: 30 Location: New Jersey
|
OS: Windows 2003 Server, Enterprise Edition
MQ: 5.3 CS09 |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 18, 2006 9:35 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Normally there should be no reason to make the simultaneous connection.
Check out your design and change it so that all endpoints (queues/topics) are on the same qmgr. Remember if you send something to a remote qmgr all you need is a default path to said qmgr. Remote queues are not a requirement... but they sure do help!!
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rajesh.palled |
Posted: Thu Jan 19, 2006 5:44 am Post subject: |
|
|
 Apprentice
Joined: 16 Feb 2004 Posts: 30 Location: New Jersey
|
We have Auditing Queues & Exception Queues on one remote queue manager and Application Related Queues on another remote queue manager. But all queue managers are in a cluster. We can make our application work with using either both Client Connections or both Server Connections.
But during deployment it happened accidently that we configured Client Connection for connecting to Auditing & Exception Queues and Server (Bind) Connection to access Application Queues through property file.
Our code has the logic of checking if the port no & host name exists in property file then it connects to QMGR using Client Connection or it connects using Server Connection (Binding Mode).
When we set up property file like one uses Client Conneciton and other uses Server Connection then we encountered MQRC 2058 although all are in a cluster.
Vennela has written a code in the link which she provided where Java Program has both Client Connections or Both are Server Connections. but there is no mix of Client and Server Connection whcih we do have.
I was just curious whether this combination will work or not. If it does not then wanted to find out what is the reason for this combination for nor working as we have two instants of Queue Managers where one instance uses Client Connection and other instance uses Server Connection. So both are independent while accessing the property files for host/port etc. |
|
Back to top |
|
 |
rajesh.palled |
Posted: Mon Jan 23, 2006 12:52 pm Post subject: |
|
|
 Apprentice
Joined: 16 Feb 2004 Posts: 30 Location: New Jersey
|
I have tested some of the permutation and combinations for Server Binding connection and Client Connection and observed the following results.
(For this testing i was connecting to different Queue Managers within same Java Program using Binding Mode as well as Client Connections)
1. Binding Mode (Local QMGR) - Binding Mode (Local QMGR) - PASSED
2. Binding Mode (Local QMGR) - Client Connection (Remote QMGR) - PASSED
3. Binding Mode (Local QMGR) - Client Connection (Local QMGR) - FAILED
4. Client Connection (Local QMGR) - Binding Mode (Local QMGR) - PASSED
5. Client Connection (Local QMGR) - Client Connection (Local QMGR) - PASSED
My guess would be when you connect Remotely to QM1 first and then Locally to QM1 (same QMGRs) the MQEnvironment variables will be holding the values since it is the same Java thread.
But connecting Locally to QM1 and then try to connect Remotely to QM1 again, it will fail (case 3) as it does not make any sense.
Again connecting Locally to QM1 and then connecting Remotely to QM2 (diff. QMGRs) will work because these are two different queue managers. |
|
Back to top |
|
 |
|