Skip to content

Instantly share code, notes, and snippets.

@DavidBoike
Last active August 29, 2015 14:01
Show Gist options
  • Save DavidBoike/ff420add0138b6b6c9d9 to your computer and use it in GitHub Desktop.
Save DavidBoike/ff420add0138b6b6c9d9 to your computer and use it in GitHub Desktop.
Error Notifier for ServiceControl
<MessageEndpointMappings>
<add Messages="ServiceControl.Contracts" Endpoint="Particular.ServiceControl" />
</MessageEndpointMappings>
namespace ErrorNotify
{
using NServiceBus;
/*
This class configures this endpoint as a Server. More information about how to configure the NServiceBus host
can be found here: http://particular.net/articles/the-nservicebus-host
*/
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
{
public void Init()
{
Configure.Serialization.Json();
}
}
}
using System;
using NServiceBus;
using ServiceControl.Contracts.MessageFailures;
namespace ErrorNotify
{
public class ErrorNotifyCheck : IHandleMessages<MessageFailed>
{
public void Handle(MessageFailed message)
{
// URL to launch ServiceInsight
string serviceInsightUrl = String.Format("si://servicecontrolurl?Search={0}", message.FailedMessageId);
// Build the email here
Console.WriteLine("Hey someone should check out this {0}!", message.FailureDetails.Exception.ExceptionType);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment