Spring cloud Spring云数据流使用docker创建rabbitmq python应用程序

Spring cloud Spring云数据流使用docker创建rabbitmq python应用程序,spring-cloud,spring-cloud-dataflow,Spring Cloud,Spring Cloud Dataflow,我正在使用rabbitmq创建一个python流处理器,从文档中我可以理解处理基于apache-kafka的应用程序()的生命周期,但我需要在基于python流处理器的应用程序上处理rabbitmq外部集群的生命周期代码 def main(): connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) channel = connection.channel() channel.queue_

我正在使用rabbitmq创建一个python流处理器,从文档中我可以理解处理基于apache-kafka的应用程序()的生命周期,但我需要在基于python流处理器的应用程序上处理rabbitmq外部集群的生命周期代码

def main():
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
HttpHealthServer.run_thread()
def callback(ch, method, properties, body):
    print(" [x] Received %r" % body.decode())

channel.basic_consume(queue='hello', on_message_callback=callback, auto_ack=True)

print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()

if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        print('Interrupted')
        try:
            sys.exit(0)
        except SystemExit:
            os._exit(0)

提前感谢。

我认为没有一个示例包含特定于RabbitMQ的代码。感谢您的回复@IlayaperumalGopinathan我已经更新了问题中的代码……请告诉我哪里出了问题python流应用程序长期处于部署状态,我无法获取日志。提前谢谢,对不起,我不熟悉Python。希望其他人能给你一些线索。