rust-amqp icon indicating copy to clipboard operation
rust-amqp copied to clipboard

Channel.exchange_declare: Unexpected method frame

Open kopiczko opened this issue 8 years ago • 1 comments

Steps to reproduce: Notice auto_delete changes.

    channel.exchange_declare(exchange,
                          "fanout",
                          false, // pssive
                          false, // durable
                          false, // auto_delete
                          false, // internal
                          false, // nowait
                          Table::new())
        .unwrap();
    channel.exchange_declare(exchange,
                          "fanout",
                          false, // pssive
                          false, // durable
                          true, // auto_delete
                          false, // internal
                          false, // nowait
                          Table::new())
        .unwrap();

Panics with: AMQP Error: Unexpected method frame: channel.close, expected: exchange.declare-ok.

I'd expect exchange_declare to tell me that exchange is already declared without auto_delete feature.

kopiczko avatar Sep 22 '16 08:09 kopiczko

The current implementation is not handling channel errors well. The only expected response from these kind of calls is a corresponding OK method, like exchange.declare-ok, I guess it should also expect channel.close, and return it as an error.

Although, for this particular error it is strange that the server returns an error, because in the protocol specification it says that the server MUST ignore the auto-delete field if the exchange already exists.

Antti avatar Sep 23 '16 20:09 Antti