/// <summary> /// Logs the pre publish failure. /// </summary> /// <param name="message">The message.</param> /// <param name="exception">The exception.</param> public virtual void LogPrePublishFailure(T message, System.Exception exception) { try { MessageEnvelope envelope = message == null ? new MessageEnvelope(new NullMessage()) : new MessageEnvelope(message); envelope.User = this.UserName; envelope.Originator = this.Originator; envelope.ReplyTo = this.ReplyTo; envelope.ExpiresOn = this.ExpiresOn; envelope.MessageUID = Guid.NewGuid(); envelope.MessageSentOn = DateTime.UtcNow; string errorMessage = string.Format(CultureInfo.CurrentCulture, "Failed to publish {0} message", envelope.Message.GetType().FullName); logger.LogPublishFailure(envelope, errorMessage, exception, envelope.Message.GetType()); } catch (System.Exception) { } }