Before talking about the details of TEAM.Commons.Threading I need to explain TEAM.Commons.Messaging, a set of classes about communication between processes based on the concept of transport.
public interface ISendingTransport { void Send(object message); void Send(object[] messages); }
public interface IReceivingTransport { // Blocks the current thread until a message is received. IList<object> WaitForMessageWithoutTimeout(); /// Blocks the current thread until a message is received or timeout ellapses. IList<object> WaitForMessage(TimeSpan timeout); }
There are two available implementations of these transports:
public class InProcessTransport : ISendingTransport, IReceivingTransport { ... }This class implements both interfaces so that it can be used for communications between threads, handling all the related complexity. It's a very important piece used in the implementation of the advanced threading features in TEAM.Commons.Threading.
MsmqSendingTransport
Send messages through an MSMQ Queue.
MsmqReceivingTransport
Receives messages from an MSMQ Queue.
Remember, you can get all this code for free at bitbucket: http://bitbucket.org/rodolfograve/team.commons/overview
Check it out to get ideas, or simply use it as it is. It's working out for me and my team.
No comments:
Post a Comment