Search code examples
.netamqpqpid

Connecting to a qpid queue using Amqp.net lite. throws exception amqp:connection:forced


I am trying to set up a simple example to connect to and send a message to a queue. we removed authentication for qpid so as to not need a username and password. what happens is once it tries to send the message I get an AMQP exception with the message amqp:connection:forced

what does this exception mean? and any idea of what I might have missed?

        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);

Solution

  • This error typically shows up when there is an AMQP version mismatch. In your case Amqp.Net Lite uses only version AMQP 1.0 and the Qpidd broker is probably running only version AMQP 0-10. One way to get a hint is to SET QPID_LOG_ENABLE=trace+ in your environment before you execute the broker. The trace should expose the mismatch.

    To get Qpidd broker to use AMQP 1.0 you can use either of two methods:

    • Load the AMQP 1.0 library explicitly with --load-module amqp.dll (or amqp.so on linux systems).
    • Direct the broker to load all modules with --module-dir somepath where the path is the name of folder that holds the amqp.dll (or .so) file.

    If you are building Qpidd from sources you also need to build the qpid-proton project in order to provide AMQP 1.0 support.