Open tvoinarovskyi opened 8 years ago
I don't really want to break the API by making publish a coroutine. How about the publish method will return an object, that can be asked about published message state? Something like:
connection = yield from connect()
channel = yield from connection.open_channel()
channel.confirm_delivery()
exchange = yield from get_exchange(channel)
msg_monitor = exchange.publish()
if connection.paused: # Indicates if protocol writing was paused
yield from connection.flush() # Will flush write buffers. This can be used after a large pack of publish's
yield from msg_monitor.wait_ack() # Will wait for ACK. Will raise error if used without confirm_delivery()
Seems like Rabbitmq has a FlowControl system. I didn't work to much with Rabbitmq, so I don't know much about it. Apart from that the rabbitmq spec says that there are methods to start/stop flow of data, does the library need to respect it?
Why I am bringing this up? Right now the
exchange.publish
is not a coroutine. It sends data to socket without any checks. It's an issue if we want to:The questing is: What changes to the API would make those cases implementable?