AttributeError:'module'对象没有属性'Connection 10'

时间:2015-12-11 16:04:09

标签: python activemq stomp

#-*-coding:utf-8-*-
__author__ = 'abin'

import stomp
import logging
import time

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
                    datefmt='%Y-%m-%d %H:%M:%S',
                    # filename='/home/abin/local/tools/activemq-consumer.log',
                    # filename='/home/abin/local/tools/extranet-consumer.log',
                    filename='activemq-monitor.log',
                    filemode='a')

class MyListener(object):
    def on_error(self, headers, message):
        logging.error('received an error %s' % message)
    def on_message(self, headers, message):
        logging.info('received a message %s' % message)

######dev-platform####
conn = stomp.Connection10([('152.30.11.11',61613),('152.30.11.12',61613),('152.30.11.13',61613)])


conn.set_listener('', MyListener())
conn.start()
conn.connect()

conn.subscribe(destination='heart.beat', id=1, ack='auto')

time.sleep(1)
conn.disconnect()

当我通过STOMP连接ActiveMQ时,它在CentOS(CentOS版本6.7(最终版))中工作,并且它在Redhat(红帽企业Linux服务器版本6.4(圣地亚哥))中不起作用。我不知道为什么?

这个Python文件正在crontab的Linux计划中运行。

我通过STOMP插件执行此操作,以下是插件:

http://blog.csdn.net/varyall/article/details/50252243

错误是:

  

追踪(最近一次通话):     文件“/home/work/local/tools/activemq-consumer.py”,第27行,in       conn = stomp.Connection10([('152.30.11.11',61613),('152.30.11.12',61613),('152.30.11.13',61613)])   AttributeError:'module'对象没有属性'Connection10'

0 个答案:

没有答案