Erlang/OTP Forums

Author Message

<  RabbitMQ mailing list  ~  Daemonizing connection threads (was .Net client foreground

Guest
Posted: Thu Jan 07, 2010 6:40 pm Reply with quote
Guest
> At the moment there's no easy way to ask for daemon threads if you
> decide they're appropriate for your app: so maybe we should go with
> non-daemon per default, daemon per user-selectable option.

A background/daemon thread would be preferred for our situation as well.
This configurable option would be great.

In our ASP.NET applications we hook the app domain unload event and try to
complete our pending rabbit operations and close things down. Maybe
something along these lines should be recommended in the docs. Doing this
along with making the client use a background thread means you still get the
chance to cleanup and know what has and hasn't been written to the exchange,
and you also know your app will actually shutdown and not hang.


Thread.GetDomain().DomainUnload += new
EventHandler(RabbitmqAsyncCommandService_DomainUnload);

...

void RabbitmqAsyncCommandService_DomainUnload(object sender,
EventArgs e)
{
if (null != _cnn)
{
//wait for stuff to finish (up to a few seconds)...
//close the channels...

_cnn.Close();
}
}

-JD




_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum