[rabbitmq-discuss] Looking for some specific & complete C# examples
Dave Curylo
curylod at asme.org
Mon Jul 23 16:57:22 BST 2012
I also find these samples to be a little simplistic.
1. They never include heartbeat settings, and the .NET documentation is
pretty thin on these as well. Setting a heartbeat is pretty important,
otherwise if there is a network problem and your client loses connectivity,
neither your client or the message broker seem to know about it. Samples
never seem to do this.
2. They never include error handling - there are some useful exceptions
raised if connections drop, killing a subscription.
3. They never include multithreading concerns. It isn't always possible or
efficient to spin up multiple consumer processes to achieve concurrency.
It seems important to note that sharing a Connection is OK (and probably a
good thing since Connections use a limited OS resource), but sharing a
Model is not OK. From 2.10 of the API guide:
If more than one thread needs to access a particular IModel instances, the
application should enforce mutual exclusion itself. One way of achieving
this is for all users of an IModel to lock the instance itself:
IModel ch = RetrieveSomeSharedIModelInstance();
lock (ch) {
ch.BasicPublish(...);
}
I wish these samples would go into more detail about these scenarios.
On Mon, Jul 23, 2012 at 9:35 AM, Christoph <langalaxy at gmail.com> wrote:
> I'm not sure if you have already found these, but there are also Code
> Examples of the book "RabbitMQ in Action" available on GitHub:
> https://github.com/rabbitinaction/sourcecode/tree/master/csharp/appendix-a
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120723/b8812c3c/attachment.htm>
More information about the rabbitmq-discuss
mailing list