[rabbitmq-discuss] Looking for some specific & complete C# examples
Dave Curylo
curylod at asme.org
Mon Jul 23 18:10:27 BST 2012
I apologize if you get a duplicate of this…I sent from the wrong account last time:
I 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 and/or documentation would go into more detail about these scenarios. I've figured them out through trial and error or reading through driver code.
On Jul 23, 2012, at 9:35 AM, Christoph 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/b8725343/attachment.htm>
More information about the rabbitmq-discuss
mailing list