本文整理匯總了Python中pypeman.channels.BaseChannel.replay方法的典型用法代碼示例。如果您正苦於以下問題:Python BaseChannel.replay方法的具體用法?Python BaseChannel.replay怎麽用?Python BaseChannel.replay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pypeman.channels.BaseChannel
的用法示例。
在下文中一共展示了BaseChannel.replay方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_replay_from_memory_message_store
# 需要導入模塊: from pypeman.channels import BaseChannel [as 別名]
# 或者: from pypeman.channels.BaseChannel import replay [as 別名]
def test_replay_from_memory_message_store(self):
""" We can store a message in FileMessageStore """
store_factory = msgstore.MemoryMessageStoreFactory()
chan = BaseChannel(name="test_channel10.5", loop=self.loop, message_store_factory=store_factory)
n = TestNode()
msg = generate_msg(with_context=True)
msg2 = generate_msg(timestamp=(1982, 11, 27, 12, 35))
chan.add(n)
# Launch channel processing
self.start_channels()
self.loop.run_until_complete(chan.handle(msg))
self.loop.run_until_complete(chan.handle(msg2))
msg_stored = list(self.loop.run_until_complete(chan.message_store.search()))
for msg in msg_stored:
print(msg)
self.assertEqual(len(msg_stored), 2, "Should be 2 messages in store!")
self.loop.run_until_complete(chan.replay(msg_stored[0]['id']))
msg_stored = list(self.loop.run_until_complete(chan.message_store.search()))
self.assertEqual(len(msg_stored), 3, "Should be 3 messages in store!")