|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Can the ActiveX API be use to connect to multiple QMs? |
« View previous topic :: View next topic » |
Author |
Message
|
bartland |
Posted: Tue May 04, 2004 7:38 pm Post subject: Can the ActiveX API be use to connect to multiple QMs? |
|
|
Novice
Joined: 04 May 2004 Posts: 15
|
Having reviewed the doco and the posts in this forum, I am under the impression that the ActiveX (MQAX200.DLL) API cannot be used to specify the channel information so the multiple (client) connections can be made to differing servers/queue managers.
I have inherited a Delphi app that uses MQAX200 and relies on the MQSERVER env variable. I do not want to use MQCHLLIB/TAB. Will I have to recode to use the MQI API?
From fschofer (Fri Apr 23, 2004)
"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." (Clients PDF, Chapter 10)
thanks _________________ bruce |
|
Back to top |
|
 |
JasonE |
Posted: Wed May 05, 2004 3:44 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
I dont believe the activeX can do an MQCONNX, so you either need to use the channel tables, which you indicated you were unwilling to use, or find another way of calling the MQAPI. I dont know Delphi, but I would guess you can call the C functions
Just a random thought, have you tried setting the environment variable, MQSERVER, then connecting, and on the 2nd thread doing the same? ie setting MQSERVER to a different value then connecting (MQSERVER is only ever referenced one, at connect time to build a default channel definition). Note I think you would need to call the MSVCRT setenv call to update the environment of the C runtime, which is where MQ gets it from. No idea if this will work, but trying to be creative... |
|
Back to top |
|
 |
bartland |
Posted: Wed May 05, 2004 4:28 pm Post subject: |
|
|
Novice
Joined: 04 May 2004 Posts: 15
|
ok. thanks.
Yes, I've successfully used the win API call SetEnvironmentVariable. However, I've had to do that from a different exe. This first exe does the SetEnvironmentVariable then a ShellExecute of the Delphi app. The same thing can be done using a DOS batch file
Set MQSERVER=.............
DelphiApp.exe
but you get the DOS console also displayed. A WSH script would also work well.
Modifying the Delphi code itself to do the SetEnvironmentVariable prior to calling
FCurrentSession := CoMQSession.Create();
FQueueManager := MQQueueManager(FCurrentSession.AccessQueueManager(''));
doesn't work. The MQ APIs already seem to have read the environment variable??? The only thing I can think of is that the exe loads the MQAX200 at load time like a staticly linked DLL(though it did it at CoClass create). This means the DLLInit function must be doing the read and caching it. Very rude if that's the case.
Probably the best solution is to migrate everything to the .NET (or Java ) APIs.
cheers _________________ bruce |
|
Back to top |
|
 |
JasonE |
Posted: Thu May 06, 2004 1:09 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
I wouldnt disagree there... Note the VB .NET api has an activeX 'emulation' layer - See the xmq* vb samples. It should make the porting from mqax -> .net easier.
Let me know if you come up with major problems using this layer where the compatibility isnt right... |
|
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
|
|
|
|