[rabbitmq-discuss] Pika and multi-threading
Denis Conan
Denis.Conan at telecom-sudparis.eu
Wed Feb 23 15:33:05 GMT 2011
Le 23/02/2011 16:28, Gavin M. Roy a écrit :
>
>
> 2011/2/23 Denis Conan <Denis.Conan at telecom-sudparis.eu
> <mailto:Denis.Conan at telecom-sudparis.eu>>
>
> Le 22/02/2011 17:02, Gavin M. Roy a écrit :
>
> 2011/2/22 Denis Conan<Denis.Conan at telecom-sudparis.eu
> <mailto:Denis.Conan at telecom-sudparis.eu>>:
>
>
> Hi all,
>
> The Pika Web site says: "Pika does not have any notion of
> threading in the
> code. If you want to use Pika with threading, make sure you
> have a Pika
> connection per thread, created in that thread. It is not
> safe to share one
> Pika connection across threads."
>
> When using the continuation-passing style mode with
> SelectConnection, what
> about the singleton object IOLoop? I created a connection on
> the main thread
> for a vhost, and then a second connection for a different
> vhost in a new
> thread, but callbacks of the main threads for the first
> vhost are called. Am
> I missing something?
>
>
> You're not, this is something I'm working through now. In essence,
> there is a logical separation in the pika code between the core
> of how
> pika does what it does and the connection adapters. The singleton
> model for ioloops was a later addition that broke the model with
> regard to threads. I have been working on fixing this to be thread
> safe and will have something out soon on it.
>
>
> Thank your for the answer.
>
> In the meantime, forking the process may be an alternative. Is there
> a "simple" mean to de-register a callback?
>
>
> Simple is relative to how deep the it was that the callback was
> registered. What type of callback do you want to unregister?
The one for the treatment of delivered messages that was registered in a
basic_consume.
>
> Gavin
--
Denis Conan
Institut Télécom, Télécom SudParis
http://www-public.telecom-sudparis.eu/~conan
More information about the rabbitmq-discuss
mailing list