2015-10-20 29 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. 

所以遠程端是告訴你的客戶端無法連接。

我會檢查代理端的日誌,看看連接上是否有一些有意義的錯誤信息。