[rabbitmq-discuss] Python example on event-driving consumer?
majek04 at gmail.com
Mon Jan 9 11:52:51 GMT 2012
On Fri, Jan 6, 2012 at 21:54, njsss <njsss2011 at gmail.com> wrote:
> The problem I see is that at the end there's this ioloop, which I
> first thought only running at background, but instead continue
> blocking until ctrl+C.
> However, I have a panda3d game animation, and I want while it is
> rendering, still can listen outside calls and make certain changes.
> With the ioloop, the animation won't even be able to start. without
> it, the connection does not seem to fully connected, and will not
> listen to the rabbitmq.
> What is the easiest to do it?
Generally, if you want to wait for messages from RabbitMQ, you
will need to `wait`. If you must do computation at the same time -
it gets complicated.
The usual way of dealing with the problem is to use threads.
In one thread you could wait on a rabbitmq client, in other
thread you could do cpu-intensive computation.
But it's easy to mess up with the synchronization, so beware.
Alternatively, you may review the Puka client library:
This library allows you to build your own `select` waiting
loop, which may help if you want to `wait` on multiple
socket descriptors (not only a rabbitmq client descriptor).
OTOH, it won't directly help with the problem of
latency-sensitive Rabbitmq connection and a CPU-intensive task.
Hope that helps,
More information about the rabbitmq-discuss