Polyconseil / aioamqp

AMQP implementation using asyncio
Other
280 stars 88 forks source link

Should not have simultaneous publishes on a channel. #94

Open foolswood opened 8 years ago

foolswood commented 8 years ago

Delivery tags are server generated (and no guarantees are stated in the spec), at present aioamqp assumes that they will be incrementing by 1 from 1, which seems to hold (at least for rabbitmq).

However, the return method does not receive the delivery tag, so the asynchronous publishes that are currently allowed are not possible to implement with this.

Probably, strictly speaking, we shouldn't be guessing the delivery tag anyway.

mwfrojdman commented 8 years ago

My pull request is probably responsible for that. It was added to support server acks aka the publish confirm extension of RabbitMQ. The trouble is that there is no way to know explicitly which delivery tag a published message has. The same basic.ack method is used for both server and client messages. But only the server gives a delivery tag parameter with its basic.deliver and basic.get-ok messages. Basic.publish has no such thing. I don't think it's possible with the current extension to do anything except index the published messages like now. Should be safe though, as they're sent sequentially over the channel.

foolswood commented 8 years ago

It works until you set the mandatory flag, then as return methods don't carry the counter it is not possible to work out which of the multiple "in flight" publish messages it refers to.