Created
June 11, 2013 16:20
-
-
Save phatboyg/5758302 to your computer and use it in GitHub Desktop.
This is an example of a convention-based consumer with no dependencies on MassTransit.
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 class FreeConsumer | |
{ | |
public event EventHandler<MyPublishedEvent> MyPublish; | |
public void CommandHandler(MyCommand command) | |
{ | |
// process the command | |
// the event handler will be bound by MT to publish the event handler message type | |
MyPublish(this, new MyPublishedEvent(...)); | |
} | |
// Request is a message type being consumed, Response is a message type being sent back | |
public Response RequestHandler(Request request) | |
{ | |
// process the request | |
// will be sent via context.Respond to the requester | |
return new Response(...); | |
} | |
// all thrown exceptions are returned as Fault<T> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment