[rabbitmq-discuss] Publishing delay when process is active
ask at rabbitmq.com
Fri Jun 29 19:58:02 BST 2012
On 22 Jun 2012, at 05:09, Scott Persinger wrote:
> I have a daemon process which uses a Tornado IO loop for event processing and the pika/TornadoConnection class
> for interacting with Rabbit.
> My processing loop looks like:
> -wait to receive a Rabbit message (ioloop.start())
> -on message:
> - loop
> - do some work
> - publish a status message (like "work item #1 complete")
> My problem is that in the case there is lots of work to do, then messages published inside the "do some work"
> loop don't seem to get sent until processing is finished and returns
> to the ioloop. Is there some way to make those messages be published immediately, like a flush? Or is there
> a different pattern I should use to ensure timely publishing?
If by 'do some work' you mean calling blocking functions, then I would guess
that messages are not written to the socket because the eventloop is not entered
until after the blocking calls return.
Maybe there's a method on ioloop to run the eventloop for one tick and then
continue with your work.
More information about the rabbitmq-discuss