public bool LostMessageLog(object message, Exception exception)
        {
            if (!_logging)
            {
                return(false);
            }

            try
            {
                LostMessageNotification notification = new LostMessageNotification
                {
                    ReceiverId      = (int)_serviceType,
                    SenderId        = ((BaseServiceBusModel)message)._ProducerId,
                    Topic           = Convert.ToString(((BaseServiceBusModel)message)._TopicName),
                    EventId         = Convert.ToString(((BaseServiceBusModel)message)._EventId),
                    Message         = message != null && ((BaseServiceBusModel)message)._OriginalMessage != null ? ((BaseServiceBusModel)message)._OriginalMessage : string.Empty,
                    ExceptionDetail = exception != null?JsonConvert.SerializeObject(exception) : string.Empty,
                };

                return(_eventBus.Publish(notification));
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// Losts the message notification.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="message">The message.</param>
 /// <returns></returns>
 public static async Task LostMessageNotification <T>(T message)
 {
     try
     {
         LostMessageNotification lostMessage = message as LostMessageNotification;
         LogFacade logFacade = new LogFacade();
         Models.BaseResponse <string> businessResponse = logFacade.AddLostEventBudsMessage(lostMessage);
     }
     catch (Exception ex)
     {
     }
 }