Created
January 29, 2010 15:06
-
-
Save KevM/289777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IMessagePublisher | |
| { | |
| void Publish<MESSAGE>(MESSAGE message) where MESSAGE : class; | |
| } | |
| public class MessagePublisher : IMessagePublisher | |
| { | |
| private readonly MessageBusSettings _messageBusSettings; | |
| private readonly IEndpointFactory _endpointFactory; | |
| public MessagePublisher(MessageBusSettings messageBusSettings, IEndpointFactory endpointFactory) | |
| { | |
| _messageBusSettings = messageBusSettings; | |
| _endpointFactory = endpointFactory; | |
| } | |
| public void Publish<MESSAGE>(MESSAGE message) where MESSAGE : class | |
| { | |
| var queueName = _messageBusSettings.MessageQueue; | |
| var messageEndpoint = _endpointFactory.GetEndpoint(queueName); | |
| messageEndpoint.Send(message); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment