2015-10-20 133 views
1

我想设置一个简单的例子来连接并发送消息到队列。我们删除了qpid的身份验证,以便不需要用户名和密码。发生什么事情是,一旦它试图发送消息我得到一个AMQP异常与消息amqp:连接:强制使用Amqp.net lite连接到qpid队列。抛出异常amqp:连接:强制

这个异常是什么意思?以及我可能错过了什么?

 string broker = "amqp://linuxlab.netigrate.net:5672"; 
     string outQueue = "toVCC"; 
     string inQueue = "fromVCC"; 

     Connection.DisableServerCertValidation = true; 

     Connection connection = null; 

     try 
     { 
      Address address = new Address(broker); 
      connection = new Connection(address); 
      Session session = new Session(connection); 

      SenderLink sender = new SenderLink(session, "sendAndRecieve.send", outQueue); 

      Message message = new Message("Hello"); 

      sender.Send(message); 

回答

1

当AMQP版本不匹配时,通常会显示此错误。在你的情况下,Amqp.Net Lite仅使用版本AMQP 1.0,而Qpidd代理可能只运行版本AMQP 0-10。获得提示的一种方法是在您执行代理之前,在您的环境中设置QPID_LOG_ENABLE = trace +。痕迹应该揭示错配。

要获得Qpidd经纪人使用AMQP 1.0,你可以使用以下两种方法之一:

  • 负载与--load模块的AMQP 1.0库明确amqp.dll(或amqp.so在Linux上系统)。
  • 指示代理以加载所有模块--module-dir somepath其中路径是保存amqp.dll(或.so)文件的文件夹的名称。

如果您从源代码构建Qpidd,则还需要构建qpid-proton项目以提供AMQP 1.0支持。

+0

非常感谢,我一直在困扰着我的头靠在墙上好几天了解这个问题。现在就解决了:) – inifus

1

从AMQP 1.0规格的AMQP:连接:强制错误代码:

An operator intervened to close the connection for some reason. The client could retry at some later date. 

所以远程端是告诉你的客户端无法连接。

我会检查代理端的日志,看看连接上是否有一些有意义的错误信息。

相关问题