コード例 #1
0
 def pub(self, msg, topic_string, *opts):
     topic = pymqi.Topic(self.qmgr, topic_string=topic_string)
     topic.open(open_opts=pymqi.CMQC.MQOO_OUTPUT)
     if isinstance(msg, str) and not isinstance(msg, bytes):
         raise AttributeError('msg must be bytes (not str) to publish to topic.')  # py3
     topic.pub(msg, *opts)
     topic.close()
コード例 #2
0
def getTopic():
    logger.info('Connecting to Topic')
    try:
        t = pymqi.Topic(qmgr, topic_string=MQDetails[EnvStore.TOPIC_NAME])
        t.open(open_opts=pymqi.CMQC.MQOO_OUTPUT)
        return t
    except pymqi.MQMIError as e:
        logger.error("Error getting topic")
        logger.error(e)
        return None
コード例 #3
0
ファイル: test_pubsub.py プロジェクト: vikki1107/pymqi
 def pub(self, msg, topic_string, *opts):
     topic = pymqi.Topic(self.qmgr, topic_string=topic_string)
     topic.open(open_opts=pymqi.CMQC.MQOO_OUTPUT)
     topic.pub(msg, *opts)
     topic.close()