Skip to content

Instantly share code, notes, and snippets.

@cbcwebdev
Created September 14, 2011 18:13
Show Gist options
  • Save cbcwebdev/1217302 to your computer and use it in GitHub Desktop.
Save cbcwebdev/1217302 to your computer and use it in GitHub Desktop.
Keeping track of published messages
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