tsturzl commented on issue #55:
URL: 
https://github.com/apache/pulsar-client-python/issues/55#issuecomment-1759925342

   @zbentley Integrating this client with asyncio is incredibly frustrating, 
because it's not entirely clear which thread things are running in and much of 
asyncio is **not threadsafe**. In order to get these callbacks to work with 
asyncio you have to resort to low level threadsafe facilities of asyncio, 
making it far less trivial to safely integrate this client with asyncio than 
you portray.
   
   For example if you want to use `send_async`. Intuition might lead you to 
just pass a future into that callback, and set the result of that future when 
you're done. You cannot do that, because Future is not threadsafe. You instead 
need to call `future.set_result` using 
`loop.call_soon_threadsafe(future.set_result, res)`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to