private void HandlerException(object sender, HandlerExceptionEventArgs e) { var @event = ExceptionEventExtensions.CoreHandlerExceptionEvent(e.Exception, hostName, ipAddresses); @event.HandlerTypeFullName = e.MessageHandler.GetType().FullName; @event.MessageId = e.TransportMessage.MessageId; @event.MessageTypeFullName = e.TransportMessage.MessageType; @event.WorkQueueUri = e.WorkQueue != null ? e.WorkQueue.Uri.ToString() : string.Empty; @event.ErrorQueueUri = e.ErrorQueue != null ? e.ErrorQueue.Uri.ToString() : string.Empty; @event.RetryCount = e.TransportMessage.FailureMessages.Count() + 1; @event.MaximumFailureCount = e.PipelineEvent.Pipeline.State.GetServiceBus().Configuration.Inbox.MaximumFailureCount; // cannot publish here since handler is wrapped in a transaction scope // will always also result in pipeline exception so publish there lock(padlock) { deferredEvents.Add(@event); } }
public void OnHandlerException(object sender, HandlerExceptionEventArgs args) { HandlerException.Invoke(sender, args); }