【发布时间】:2017-08-03 20:11:06
【问题描述】:
我想将从 ActiveMQ 中的队列中获得的消息存储到字符串中,但我不知道该怎么做。我的代码如下:
import stomp
import time
class SampleListener(object):
def on_message(self, headers, msg):
print(msg)
conn = stomp.Connection10()
conn.set_listener('SampleListener', SampleListener())
conn.start()
conn.connect()
conn.subscribe('test2')
time.sleep(1) # secs
conn.disconnect()
【问题讨论】:
-
把它存储到一个字符串在哪里?在磁盘上?
-
@roganjosh 在代码上,所以我以后可以使用它。