envStore = EnvStore() envStore.setEnv() MQDetails = {} credentials = { EnvStore.USER: EnvStore.getEnvValue(EnvStore.APP_USER), EnvStore.PASSWORD: EnvStore.getEnvValue(EnvStore.APP_PASSWORD) } buildMQDetails() logger.info('Credentials are set') #logger.info(credentials) #conn_info = "%s(%s)" % (MQDetails[EnvStore.HOST], MQDetails[EnvStore.PORT]) conn_info = EnvStore.getConnection(EnvStore.HOST, EnvStore.PORT) msgObject = { 'Greeting': "Hello from Python! " + str(datetime.datetime.now()) } qmgr = None topic = None qmgr = connect() if (qmgr): topic = getTopic() # queue.put(message.encode()) if (topic): publishMessage() topic.close()
envStore = EnvStore() envStore.setEnv() MQDetails = {} credentials = { 'USER': EnvStore.getEnvValue('APP_USER'), 'PASSWORD': EnvStore.getEnvValue('APP_PASSWORD') } buildMQDetails() logger.info('Credentials are set') logger.info(credentials) #conn_info = "%s(%s)" % (MQDetails['HOST'], MQDetails['PORT']) conn_info = EnvStore.getConnection('HOST', 'PORT') qmgr = None subscription = None qmgr = connect() if (qmgr): subscription = getSubscription() if (subscription): getMessages() subscription.close(sub_close_options=pymqi.CMQC.MQCO_KEEP_SUB, close_sub_queue=True) if (qmgr): qmgr.disconnect()