[Twisted-Python] pyactivemq interfering with Twisted?

Brian Baquiran brianbaquiran at gmail.com
Tue Mar 18 22:25:02 MDT 2008


Itamar Shtull-Trauring wrote:
> On Tue, 2008-03-18 at 20:04 +0800, Brian Baquiran wrote:
> 
>> Could the part of pyactivemq (or ActiveMQ-CPP) that handles asynchronous 
>> consumption of messages be interfering somehow with Twisted's event loop 
>> and causing this problem?
> 
> Quite possibly; if the API you're calling is blocking then Twisted's
> event loop won't be able to run. If that is the case, either figure out
> if you can integrate the library with Twisted's event loop, or use
> twisted.internet.threads.deferToThread or something similar to call the
> blocking API.

Hi Itamar,
Thanks a lot for the tip. I just used reactor.callFromThread() from 
inside the onMessage() callaback to execute the twisted code in the 
Twisted event loop instead of in the pyactivemq event loop and it seems 
to have solved the problem.

Regards,
Brian




More information about the Twisted-Python mailing list