This repository was archived by the owner on Aug 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Peter Ritchie edited this page Jul 28, 2017
·
3 revisions
The Messaging.Primitives library provides primitive types (interfaces) to promote message/event-oriented design in .NET. The main goal is to facilitate a composable message-oriented application by separating the responsibilities of routing message from handling/processing messages.
public class GetLastTradePriceCommand : IMessage
{
/// <summary><seealso cref="IMessage.CorrelationId"/></summary>
public string CorrelationId { get;set; }
/// <summary>The symbol name whose last trace price to retrieve.</summary>
public string Symbol { get; set; }
}
public class GetLastTradePriceCommandHandler : IConsumer<GetLastTradePriceCommand> where T : IMessage
{
public void Handle(GetLastTradePriceCommand message)
{
// TODO: something with message
}
}
public void RegisterMessageHandler(IBus bus, GetLastTradePriceCommandHandler handler)
{
bus.AddHandler(handler);
}
public void RouteMessage(IBus bus, GetLastTradePriceCommand command)
{
bus.Handle(command);
}