如何知道何时所有消息都已从队列中消耗掉了?

时间:2019-08-05 07:54:45

标签: rabbitmq pika

我有一个将数据发送到队列a的生产者。 我有一个消费者/引擎正在监听a中的消息。

我很想通过将消息放在对象内的列表中来处理消息。

我现在正尝试将它们发送到另一个名为b的队列。

我的问题是:

  • 我的使用者/引擎如何仅在处理所有队列a后才能发回数据?

producer.py

def on_new_message(self, body):
    # decode the body
    body = self.decode_message(body)
    self.a_list.append(body)

def some_processing(self):
    #do some operations on self.a_list
    ...

def send_message(self):
    #encode the boby
    body = json.dumps(self.some_processing(), ensure_ascii=False),
    #send the message to queu b
    ...

0 个答案:

没有答案