Created
September 14, 2011 18:13
-
-
Save cbcwebdev/1217302 to your computer and use it in GitHub Desktop.
Keeping track of published messages
This file contains 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
protected void Button_Click(object sender, EventArgs e) | |
{ | |
// give the message a unique identifier (guid?) | |
var message = new SomeActionMessage(); | |
// ---------------------------------------------------- | |
// I'm adding my messages to a queue with 2 properties | |
// The current time, and the ID of the message | |
// ---------------------------------------------------- | |
// use callback to infer what happened with | |
// the message we just published | |
Bus.Instance.Publish(message, SomeActionMessageCallback); | |
} | |
private static void SomeActionMessageCallback(IPublishContext<SomeActionMessage> message) | |
{ | |
// here you can see a lot about what happened with the message | |
// just use intellisense to inspect the published context | |
// ------------------------------------------------------------------ | |
// Here, I remove an entry in the queue where the ID = message ID | |
// I can then inspect the queue over time, and the timestamp gives | |
// a nice estimate of how many messages a minute, or an hour are not | |
// successfully being processed | |
// ------------------------------------------------------------------ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment