Closed fake-name closed 8 years ago
Looking through the AMQP protocol specs, it looks like the way the AMQP protocol is defined makes it rather difficult to map to a coroutine-like API. A lot of AMQP libraries have implemented some form of timeout on top of AMQP, but they all seem to do it as an additional layer above the AMQP interface, rather then by using a protocol mechanism, probably because the protocol seems to require synchronicity. Annoying.
Apparently Queue.get()
doesn't block. Huh.
How can I get an item from the receive queue if present, without blocking if there are no messages available?
As far as I can tell from the docs,
basic_get()
andbasic_consume()
are both blocking (despite the misleadingly namednowait
parameter for the latter (though we can blame AMQP for that)).Right now, it seems you have to spin up a thread specifically for the purpose of polling the RX queue, which makes any attempt to design a synchronous system quite horribly messy. Either a
try_get()
call or a timeout parameter onbasic_get()
seem like they'd be hugely helpful.