python - RabbitMQ 不断关闭连接

标签 python multithreading rabbitmq amqp

我正在使用rabbitpy python库与RabbitMQ交互。我设计了一个具有发布者方法和消费者方法的通信类。该通信类的实例在单独的线程中运行。

如果我开始频繁请求,RabbitMQ 会关闭连接。这是错误日志:

=ERROR REPORT==== 4-Apr-2014::14:12:52 ===
AMQP connection <0.13197.22> (running), channel 1 - error:
{amqp_error,unexpected_frame,
            "expected content header for class 60, got non content header frame instead",
            'basic.publish'}

=INFO REPORT==== 4-Apr-2014::14:12:52 ===
closing AMQP connection <0.13197.22> (127.0.0.1:52234 -> 127.0.0.1:5672)

=INFO REPORT==== 4-Apr-2014::14:12:52 ===
accepting AMQP connection <0.13263.22> (127.0.0.1:52237 -> 127.0.0.1:5672)

rabbitpy 是一个线程安全库(它是这么说的)。

为什么我会遇到这样的问题?

最佳答案

看起来问题出在多线程上。可能是rabbitpy 中的一个错误。 解决方案是:

  • 避免在多个线程连接内的同一 channel 上发布
  • 在您自己的代码中同步发布

查看this discussion

关于python - RabbitMQ 不断关闭连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22864473/

相关文章:

java - 如何编写java线程池程序来读取文件内容?

spring-boot - 更新rabbitmq中消息的有效负载

python - Tastypie:queryset = Model.objects.all()

python - 将 re.search 函数应用于 Python 中的列

python - 在python中将符号表达式转换为数组

c - 具有循环缓冲区的多生产者单消费者

java - 服务器向客户端发送消息

message-queue - 如何在RabbitMQ中撤回消息?

c# - 具有接口(interface)属性的 MassTransit 发送命令

python - 阅读无限流-tail