我使用下面的python代码与Python2的旧版本pymqi建立了到公共队列的连接:
import logging
import pymqi
logging.basicConfig(level=logging.INFO)
queue_manager = 'QM1'
channel = 'BZU.UAT.CHNL'
host = '245.274.46.56'
port = '1416'
queue_name = 'BZU.UAT.QUEUE'
conn_info = '%s(%s)' % (host, port)
ssl_cipher_spec = 'TLS_RSA_WITH_3DES_EDE_CBC_SHA'
key_repo_location = 'D:\\App\\BZU\\keydb\\key'
message = 'Hello from Python!'
cd = pymqi.CD()
cd.ChannelName = channel
cd.ConnectionName = conn_info
cd.ChannelType = pymqi.CMQC.MQCHT_CLNTCONN
cd.TransportType = pymqi.CMQC.MQXPT_TCP
cd.SSLCipherSpec = ssl_cipher_spec
cd.UserIdentifier = 'BZU'
cd.Password = ''
sco = pymqi.SCO()
sco.KeyRepository = key_repo_location
qmgr = pymqi.QueueManager(None)
qmgr.connect_with_options(queue_manager, cd, sco)
put_queue = pymqi.Queue(qmgr, queue_name)
put_queue.put(message)
get_queue = pymqi.Queue(qmgr, queue_name)
logging.info('Here is the message again: [%s]' % get_queue.get())
put_queue.close()
get_queue.close()
qmgr.disconnect()不幸的是,此代码不适用于Python 3的pymqi版本1.9.3。
Traceback (most recent call last):
File ".\mq_conn_with_ssl.py", line 33, in <module>
qmgr.connect_with_options(queue_manager, cd, sco)
File "D:\App\BZU\arn-basis-common\py\pymqi\__init__.py", line 1347, in connect_with_options
raise MQMIError(rv[1], rv[2])
pymqi.MQMIError: MQI Error. Comp: 2, Reason 2393: FAILED: MQRC_SSL_INITIALIZATION_ERROR我必须将这段代码中的所有字符串转换为字节,因为程序要求所有字符串都是字节。示例:
queue_manager = b'QM1‘
在您声明的注释中,您在AMQERR01.LOG文件中发现了以下错误:
AMQ9716: Remote SSL certificate revocation status check failed for channel 'BZU.UAT.CHNL'.发布于 2020-03-12 18:13:25
比较工作服务器上的mqclient.ini文件和非工作服务器上的SSL:节中的差异,这将解释OCSP检查失败的原因。
mqclient.ini文件的位置可以在IBM知识中心页面IBM MQ>Configuring>Configuring connections between the server and clients>Configuring a client using a configuration file>Location of the client configuration file中找到。见下文摘要:
环境变量MQCLNTCF.
关于SSL节的mqclient.ini文档可以在IBM知识中心页面IBM MQ>Configuring>Configuring connections between the server and clients>Configuring a client using a configuration file>SSL stanza of the client configuration file中找到。见下文摘要:
OCSPAuthentication =可选的REQUIRED \x{e76f}警告
OCSPCheckExtensions = YES \x\x{e76f}没有
SSLHTTPProxyName = string
https://stackoverflow.com/questions/60656346
复制相似问题