retupmoca / P6-Net-AMQP

MIT License
6 stars 4 forks source link

declare-queue should allow empty name #13

Closed abraxxa closed 7 years ago

abraxxa commented 8 years ago

So the AMQP broker generates a queue name. That's useful for non-durable, auto-delete queues. In that case Net::AMQP::Queue should fetch the generated name after a successful declare and populate its name attribute with the broker assigned name.

jonathanstowe commented 8 years ago

I thought it did to be honest, let me check.

jonathanstowe commented 8 years ago

https://github.com/retupmoca/P6-Net-AMQP/commit/639361d1c07efff93756aa374b44bc1bfc196fca should have implemented it (and it is tested for,) so you will need to supply some code that doesn't work as expected.

abraxxa commented 8 years ago

Calling declare-queue fails for me with an invalid number of arguments error. It seems passing an empty string works but I'd prefer passing none ninstead.

jonathanstowe commented 8 years ago

A patch to make declare-queue a multi with samewith("") would work fine, I'll take a peek at some point.

abraxxa commented 8 years ago

Thanks! Is a multi-sub really required to allow undef and ''?

jonathanstowe commented 8 years ago

well, an alternative would be to provide the method with a default of "" for the name. I prefer multis :)

jonathanstowe commented 7 years ago

This is out in the v0.1.5 sorry it took so long, I forgot about it :)

abraxxa commented 6 years ago

The longer syntax where you can supply passive and durable still doesn't allow passing of an undefined name, '' works as a workaround.

jonathanstowe commented 6 years ago

Are you sure? I've just added a test that does $channel.declare-queue(:durable, :exclusive) and it works fine. You'll probably want to make sure you've got the latest version (which is 0.1.9 now)/

abraxxa commented 6 years ago

I've used the following syntax:

my $q = $channel.declare-queue(
        '',
        passive     => False,
        durable     => False,
        exclusive   => True,
        auto-delete => True,
    ).result;
jonathanstowe commented 6 years ago

You shouldn't need to do that $channel.declare-queue(:exclusive, :auto-delete) should work fine.

abraxxa commented 6 years ago

As neither a type nor a default value is specified in the method signature I wasn't sure what they will end up with.