【问题标题】:Cannot connect with RabbitMQ using Swift无法使用 Swift 连接 RabbitMQ
【发布时间】:2016-11-27 01:25:42
【问题描述】:

我开始在 Swift 中使用 RabbitMQ。我在 github 上遵循了 RabbitMQ 库中的示例代码:

let delegate = RMQConnectionDelegateLogger() 
let conn = RMQConnection(uri: "amqp://localhost:5672", delegate: delegate)

conn.start()

let ch = conn.createChannel()

let q = ch.queue("hello")
q.subscribe { rm in
    print(rm.content )
}

我经常遇到这些错误:

将开始恢复连接: disconnectedWithError: Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo={NSLocalizedDescription=Socket closed by remote peer}RMQConnection: 0x7fdb43c73670>

在 RabbitMQ 日志中我得到了这个错误:

AMQP 连接 错误(172.19.0.1:53144 -> 172.19.0.4:5672,状态:开始): PLAIN 登录被拒绝:用户'' - 无效凭据

在哪里可以定义凭据?我搜索了很多示例,但找不到任何东西。

【问题讨论】:

    标签: ios swift sockets rabbitmq


    【解决方案1】:

    检查一下:

    Can't access RabbitMQ web management interface after fresh install

    然后将 URL 连接更改为:

    'amqp://test:test@localhost:5672/'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-30
      • 2012-07-11
      • 1970-01-01
      相关资源
      最近更新 更多