[rabbitmq-discuss] Python example on event-driving consumer?

Marek Majkowski majek04 at gmail.com
Tue Jan 10 13:36:27 GMT 2012


On Mon, Jan 9, 2012 at 23:49, njsss <shilei1980 at gmail.com> wrote:
> Excuse me for being a newb, but how to "loop for N ms" in Pika
> (haven't got time to look into haigha)?

Briefly looking at the sources, it looks like it's not supported, I
hope our pika gurus will correct me:
   https://github.com/pika/pika/blob/120fdea5913e7ed80536ff55634ab0f8f4554e79/pika/adapters/asyncore_connection.py

Maybe you could use `add_timeout`?

Cheers,
    Marek

> I tried to set a timeout func in the ioloop:
>
> def on_timeout():
>     global connection
>     print "timeout"
>     connection.close()
> connection.add_timeout(timeout, on_timeout)
>
> and insert these between each frame (don't really know how to do the
> queue in that game engine (panda3D) as well :( ):
>         connection = SelectConnection(parameters, on_connected)
>         connection.add_timeout(timeout, on_timeout)
>         connection.ioloop.start()
>
> but running into trouble
> "UserWarning: SelectConnection.Close invoked while closing or closed
>     self.__class__.__name__) "
>
> On Jan 9, 12:16 pm, Aaron Westendorf <aa... at agoragames.com> wrote:
>> You can also use haigha which supports pyevent and gevent for its loop.https://github.com/agoragames/haigha
>>
>> Regarding your animation loop, you can simply queue the "draw()" onto
>> the event loop so it's all in synch, use native threading, or both
>> pyevent and gevent support a concept of "loop for N milliseconds, then
>> return", so you can call that whenever your animation loop yields.
>>
>> -Aaron
>>
>> On Fri, Jan 6, 2012 at 1:02 PM, njsss <shilei1... at gmail.com> wrote:
>> > Hello all,
>>
>> > I'm new to rabbitmq and python as well. I installed pika and followed
>> > the tutorials. But what I need is an event-driving messenger. Is there
>> > anyway to do it?
>>
>> > Thanks,
>> > _______________________________________________
>> > rabbitmq-discuss mailing list
>> > rabbitmq-disc... at lists.rabbitmq.com
>> >https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>
>> --
>> Aaron Westendorf
>> Senior Software Engineer
>> Agora Games
>> 359 Broadway
>> Troy, NY 12180
>> Phone: 518.268.1000
>> aa... at agoragames.comwww.agoragames.com
>> _______________________________________________
>> rabbitmq-discuss mailing list
>> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


More information about the rabbitmq-discuss mailing list