I have a custom event system handler that sends an email when a publish transaction fails. The event is registered like this:
this.EventSystem.Subscribe<PublishTransaction, SaveEventArgs>
(this.SendNotificationEmail, EventPhases.TransactionCommitted);
The SendNotificationEmail method looks like this:
private void SendNotificationEmail(PublishTransaction transaction,
SaveEventArgs args, EventPhases phases)
{
if (transaction.Instruction.ResolveInstruction.Purpose == ResolvePurpose.Publish &&
transaction.State == PublishTransactionState.Failed)
{
// Send email
}
}
The issue I'm having is that the SendNotificationEmail method is called twice per publication transaction. This leads to multiple emails per failed transaction.
Any ideas why the event would be triggered more than once?