Using MQCHLLIB and MQCHLTAB environment variables

Asked by Michel Barakat

Does pymqi pick up the environment variables MQCHLLIB and MQCHLTAB to determine connection credentials and authentication method? Altnernatively is there a way to set the .TAB file to use programmatically?
This is useful in our case because we'd like to keep it transprarent to the application the MQ server, authentication method, and channel used.

I'm using pymqi-1.2.win32-py2.6-mq-6.0-client

Question information

Language:
English Edit question
Status:
Solved
For:
PyMQI Edit question
Assignee:
No assignee Edit question
Solved by:
Michel Barakat
Solved:
Last query:
Last reply:
Revision history for this message
Dariusz Suchojad (dsuch) said :
#1

Hi Michel,

I haven't used MQCHLLIB nor MQCHLTAB myself - using PyMQI or otherwise - and I'll have to take a look at it with regards to PyMQI over the weekend but basically, from the MQ's viewpoint, PyMQI is a regular C application. So, if it's possible for a C program to transparently take advantage of MQCHLLIB and MQCHLTAB it should be in theory possible to achieve the same in Python.

If you have some spare time right now, please have a look at what is necessary to do if it's a C one. This should be of help when trying to make PyMQI do the same.

Cheers!

Revision history for this message
Dariusz Suchojad (dsuch) said :
#2

Hello Michel,

I've read about MQCHLLIB and MQCHLTAB more and the way I see it, you won't be able to do it with the pymqi module directly methinks. Note that I'm thinking of the pymqi module not the PyMQI project.

Let me explain some more. PyMQI exposes two main modules: pymqi and pymqe. The API of pymqi doesn't really leave much room for MQCHLLIB and MQCHLTAB - for instance, channel and queue manager names are required in lots of places. However, pymqe, which mostly is a thin wrapper around MQ's API (think CONNX, PUT etc.) would do the trick I guess. You'd really need to play with it yourself and see how it suits you.

Really sorry that's the only answer and there is no direct way for doing what you need!

Revision history for this message
Michel Barakat (esz5-michel-n1hv) said :
#3

Hi Dariusz,

Thanks for your quick reply.
I've taken another look at the API and run a few tests sucessfully.
The MQ client library, which PyMQI is linked to, will pick up the two environment variables.

From Python, you simply need to connect directly to the queue manager. Something like that does the trick, assuming you have the environment variables properly set:

import pymqi

queue_manager = 'TEST01'
qmgr = pymqi.QueueManager(None)
qmgr.connect(queue_manager)
qmgr.disconnect()

Revision history for this message
Dariusz Suchojad (dsuch) said :
#4

> Thanks for your quick reply.
> I've taken another look at the API and run a few tests sucessfully.

Ah, I see. This is very interesting and I'm glad it's worked after all! :-)

--
Dariusz Suchojad