op-rabbit连接断开

时间:2016-08-10 14:25:30

标签: scala rabbitmq akka

我用op-rabbit客户端编写了一个简单的rabbit-mq amqp客户端:

    val rabbitControl = system.actorOf(Props[RabbitControl])
rabbitControl !
                  Message.topic(
                    message,
                    routingKey = topicName,
                    properties = Seq(properties.DeliveryModePersistence(persistent = false))
                  )

这种方法效果很好,但是在收到越来越多的消息之后,我发出了非常快速的警告:

05:59:59.636 [push-server-akka.actor.default-dispatcher-12] INFO  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel connected
05:59:59.637 [push-server-akka.actor.default-dispatcher-6] WARN  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel disconnected
05:59:59.638 [push-server-akka.actor.default-dispatcher-3] INFO  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel connected
05:59:59.639 [push-server-akka.actor.default-dispatcher-6] WARN  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel disconnected
05:59:59.640 [push-server-akka.actor.default-dispatcher-3] INFO  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel connected
05:59:59.641 [push-server-akka.actor.default-dispatcher-8] WARN  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel disconnected
05:59:59.642 [push-server-akka.actor.default-dispatcher-3] INFO  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel connected
05:59:59.643 [push-server-akka.actor.default-dispatcher-6] WARN  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel disconnected
05:59:59.644 [push-server-akka.actor.default-dispatcher-5] INFO  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel connected
05:59:59.645 [push-server-akka.actor.default-dispatcher-6] WARN  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel disconnected
05:59:59.647 [push-server-akka.actor.default-dispatcher-5] INFO  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel connected
05:59:59.647 [push-server-akka.actor.default-dispatcher-5] WARN  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel disconnected
05:59:59.649 [push-server-akka.actor.default-dispatcher-12] INFO  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel connected
05:59:59.650 [push-server-akka.actor.default-dispatcher-12] WARN  c.t.akka.rabbitmq.ChannelActor - akka://push-server/user/$a/connection/confirmed-publisher-channel disconnected

每秒发出数十次警告,我的amqp消息不会传递给rabbitmq(mqtt客户端)中的dests

出了什么问题?

1 个答案:

答案 0 :(得分:1)

我发现了问题。这是一个拼写错误。
在op-rabbit配置中,我设置了错误的topic-exchange-name 但错误是非常虚幻的 它应该是"没有这样的交换"

op-rabbit {
  topic-exchange-name = "amq.topic"
  connection {
    virtual-host = "/"
    hosts = ["172.16.0.45"]
    username = "..."
    password = "..."
    port = 5672
    timeout = 3s
  }
}