From sirech at gmail.com Thu Oct 13 03:22:49 2011 From: sirech at gmail.com (=?ISO-8859-1?Q?Mario_Fern=E1ndez?=) Date: Thu, 13 Oct 2011 09:22:49 +0200 Subject: [bunny-amqp-devel] Publishing from multiple threads at once In-Reply-To: <8670E186-31A7-43AC-AC00-4C0B66685CD7@gmail.com> References: <8670E186-31A7-43AC-AC00-4C0B66685CD7@gmail.com> Message-ID: Hi, I'm pretty new to rabbitmq and bunny, and I've got a question about basic usage: I'm building a Sinatra app that, when processing certain requests, publish some information to an exchange to be processed later. My first attempt was to build one client and an exchange, store them in global variables, and have each request use it. This breaks when multiple requests try to publish at the same time. My question is, what is the best practice here? It is efficient to instantiate a new client and exchange for each request that needs it? Or is it better to maintain a pool of clients that can be used by the requests as needed? Cheers, Mario