Author |
Message
|
jerryzwang |
Posted: Wed Apr 21, 2004 2:18 pm Post subject: unset MQSERVER variable |
|
|
Newbie
Joined: 21 Apr 2004 Posts: 6
|
Hi all,
I am currently modifying a piece of age old code to let a mq client talk to multiple queues. The current implementation only talks to one queue and uses the environment variable "MQSERVER" approach to set up the channel. I know I can make the client talk to multiple queues by not using the MQSERVER variable and setting the channel information explicitly for each queue in the code. Howerver in order to minimize the code change, I'd like to keep the MQSERVER variable if it's possible. My approach is to change the value for MQSERVER on the fly before the client connects to the queue by using putenv() call in my code.
So in summary, what I did was to use putenv() to set the MQSERVER variable value for queue 1, connect to queue 1. Use putenv() again to change the value of MQSERVER for queue 2, connect to queue 2, and so on and so forth. My question is that I know for sure the MQSERVER information is used for the clients connecting to the queues. But I am not sure if the MQSERVER variable is still used by MQSeries after a connection is established. If it is, then my approach will fail.
I know I can write a piece of testing code to test the behavior However our dev. environment is very complicated and I just started here so a lot of things just don't compile for me.
Thanks in advance. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Wed Apr 21, 2004 3:30 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Quote: |
But I am not sure if the MQSERVER variable is still used by MQSeries after a connection is established.
|
It is only used when a MQClient application issues the MQCONN call. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Apr 22, 2004 6:05 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
If you have to modify the code, you might want to looking at the MQCONNX call. It allows you to pass in a structure (MQCNO) that has the same parameters as the MQSERVER. This would allow you to move away from any kind of putenv anomalies. |
|
Back to top |
|
 |
jerryzwang |
Posted: Thu Apr 22, 2004 6:14 am Post subject: bower5932. I know I can get around this variable, but |
|
|
Newbie
Joined: 21 Apr 2004 Posts: 6
|
i want to keep the current code as much as possible. That's why I asked the question in the first place Thanks. |
|
Back to top |
|
 |
jerryzwang |
Posted: Thu Apr 22, 2004 6:28 am Post subject: PeterPotkay, what I am worried about is the mq |
|
|
Newbie
Joined: 21 Apr 2004 Posts: 6
|
implementation behind the scene. Seems that the MQSERVER variable is only used when establishing a connection according to the programming guide. However MQ might use the info later. Say MQ might have some retry mechanism when the connection gets lost for a short period of time. I don't know for sure what exactly MQ implementation is doing. But it's hard to imagine a major product like MQ wouldn't have any self-recovery mechanism. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Apr 22, 2004 6:30 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Quote: |
It is only used when a MQClient application issues the MQCONN call.
|
_________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
jerryzwang |
Posted: Thu Apr 22, 2004 6:52 am Post subject: PeterPotkay, do you have document to support it? thx |
|
|
Newbie
Joined: 21 Apr 2004 Posts: 6
|
An official document would be great. |
|
Back to top |
|
 |
fschofer |
Posted: Thu Apr 22, 2004 7:03 am Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
Clients PDF, Chapter 10
All MQCONN or MQCONNX requests then attempt to use the channel you have
defined. However, if an MQCD structure has been defined in the MQCNO
structure supplied to MQCONNX, the channel specified by the MQCD structure
takes priority over any specified by the MQSERVER environment variable.
The MQSERVER environment variable takes priority over any client channel
definition pointed to by MQCHLLIB and MQCHLTAB.
Greetings
Frank |
|
Back to top |
|
 |
jerryzwang |
Posted: Thu Apr 22, 2004 7:54 am Post subject: we are beating the dead horse here :) |
|
|
Newbie
Joined: 21 Apr 2004 Posts: 6
|
I know MQSERVER is used by the MQCONN call. What I am concerned is how it is used after that. Can I change the value of MQSERVER when a client is running without affecting the established MQ connection? I don't have any MQ document here in the office. So I looked it up on the internet. Here's the link I found the most useful:
http://www-306.ibm.com/software/integration/support/supportpacs/individual/supportpacs/mc01_03.pdf
But looks like it's an old document. In there on page 83, it says:
"If you use the MQSERVER environment variable to define the channel between your MQSeries client machine and a server machine, this is the only channel available to your application and no reference is made to the client channel definition table."
Does it imply that the value of MQSERVER should be kept intact during the life span of the application?
Thanks. |
|
Back to top |
|
 |
Michael Dag |
Posted: Thu Apr 22, 2004 8:38 am Post subject: Re: we are beating the dead horse here :) |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
jerryzwang wrote: |
But looks like it's an old document. In there on page 83, it says:
"If you use the MQSERVER environment variable to define the channel between your MQSeries client machine and a server machine, this is the only channel available to your application and no reference is made to the client channel definition table."
Does it imply that the value of MQSERVER should be kept intact during the life span of the application?
Thanks. |
not that I know.
I just tried to use rfhutilc (client version) fired up two instances with different MQSERVER parameters setup and they seemed to keep working... _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
jerryzwang |
Posted: Thu Apr 22, 2004 9:09 am Post subject: MichaelDag, it should be working ok initially, because |
|
|
Newbie
Joined: 21 Apr 2004 Posts: 6
|
the client is able to establish the connection to different queues by using different MQSERVER values. However, again I am concerned about other scenarios such as a retry due to network problem. I think MQ should store the information it gets from MQSERVER internally and use that, not the MQSERVER variable, in case of a retry or reconnect. However I need to make sure that's the case. Thanks. |
|
Back to top |
|
 |
Michael Dag |
Posted: Thu Apr 22, 2004 9:52 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
true, as far as I know MQ does not store that information by itself.
I am afraid you need to take care of that yourself, OR stop using MQSERVER and start using a Channel Table definition file. _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 22, 2004 10:01 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Environment variables do not change, unless you specifically change them with code, during the lifetime of your program. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Apr 22, 2004 10:53 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
One more time:
It is only used when a MQClient application issues the MQCONN call.
MQ is not going to automatically go into retry logic. Your application, if coded to, will try to reconnect. It will reconnect by issuing the MQCONN call again. And at that point, it will go to whatever the MQSERVER is set to at that time. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
|