本文整理汇总了Python中stompest.sync.Stomp._send方法的典型用法代码示例。如果您正苦于以下问题:Python Stomp._send方法的具体用法?Python Stomp._send怎么用?Python Stomp._send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stompest.sync.Stomp
的用法示例。
在下文中一共展示了Stomp._send方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: int
# 需要导入模块: from stompest.sync import Stomp [as 别名]
# 或者: from stompest.sync.Stomp import _send [as 别名]
from stompest.config import StompConfig
from stompest.sync import Stomp
user = os.getenv('ACTIVEMQ_USER') or 'admin'
password = os.getenv('ACTIVEMQ_PASSWORD') or 'password'
host = os.getenv('ACTIVEMQ_HOST') or 'localhost'
port = int(os.getenv('ACTIVEMQ_PORT') or 61613)
destination = sys.argv[1:2] or ['/topic/event']
destination = destination[0]
messages = 10000
data = 'Hello World from Python'
config = StompConfig('tcp://%s:%d' % (host, port), login=user, passcode=password, version='1.1')
client = Stomp(config)
client.connect(host='mybroker')
count = 0
start = time.time()
for _ in xrange(messages):
client._send(destination=destination, body=data, headers={'persistent': 'false'})
count += 1
diff = time.time() - start
print 'Sent %s frames in %f seconds' % (count, diff)
client.disconnect(receipt='bye')
client.receiveFrame()
client.close()