[rabbitmq-discuss] Many clients using .NET API

Sam Owen sam.owen at gazprom-mt.com
Wed Jun 24 09:51:04 BST 2009



I've just started to look at RabbitMQ. I'm wondering whether the
following would be an idiomatic use of RabbitMQ from the .NET API:


Routing.Listen("queue1", "#", new ConsoleAlert());

Routing.Listen("queue1", "news.#", new EmailAlert());

Routing.Listen("queue2", "email.#", new ConsoleAlert());


Each call to Listen sets up a thread where the connection and channel
are maintained. 


public static void Listen(string queue, string routing, IRabbitListener


ThreadPool.QueueUserWorkItem(RunThis, new AlertState(queue, routing,



private static void RunThis(object state)


var alertState = state as AlertState;

      using (IConnection conn = new


            using (IModel channel = conn.CreateModel())


                  var sub = new Subscription(channel, alertState.Queue,
"topic", alertState.Routing);


                  foreach (BasicDeliverEventArgs e in sub)


e.RoutingKey, Encoding.UTF8.GetString(e.Body));







Given that .NET processes are more heavy weight than erlang's is this
the preferred way to set up many clients? 

Have I missed something in the .NET API for handling this type of case?




The information transmitted is the property of Gazprom Marketing & Trading Ltd and is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Statements and opinions expressed in this e-mail may not represent those of the company. Any review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender immediately and delete the material from any computer. 

Registered office: Gazprom Marketing & Trading Ltd, Gazprom House, 60 Marina Place, Hampton Wick, Kingston upon Thames, KT1 4BH. Registered in England No. 3768267

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090624/a0ac7fd4/attachment.htm 

More information about the rabbitmq-discuss mailing list