[Twisted-Python] pyactivemq interfering with Twisted?

Brian Baquiran brianbaquiran at gmail.com
Tue Mar 18 22:23:57 MDT 2008


Valentino Volonghi wrote:
> On Wed, Mar 19, 2008 at 2:49 AM, Brian Baquiran <brianbaquiran at gmail.com> wrote:
>> The API does not block when using an async message listener as I'm doing.
>> Here's some example pyactivemq code that shows how an asynchronous message
>> listener is registered:
>>  http://pyactivemq.googlecode.com/svn/trunk/src/examples/asynclistener.py
> 
> This API actually blocks.
> 
> Just by looking at:
>    conn = f.createConnection()
> 
> Which means that you can create a connection and immediately get the result.
> This is blocking by any relevant definition of blocking.
> 
> Considering all of this you should probably use this from deferToThread.

I was able to fix my original problem by using reactor.callFromThread() 
from the onMessage callback, so it does look like there is some 
threading going on. I'll look where deferToThread should be applied.

Thanks Valentino. I really appreciate your looking at the code.

Brian




More information about the Twisted-Python mailing list