Exemplo n.º 1
0
 /// <summary>
 /// Gets a single Poison Message, including message body and exception details.
 /// </summary>
 public static PoisonMessage GetPoisonMessage(this IDbConnection connection, Guid messageId)
 {
     using (var cmd = connection.CreateCommand())
     {
         var param = cmd.CreateParameter();
         param.ParameterName = "@messageId";
         param.Value         = messageId;
         param.DbType        = DbType.Guid;
         cmd.Parameters.Add(param);
         cmd.CommandText = Query_PosionMessage;
         using (var reader = cmd.ExecuteReader())
         {
             while (reader.Read())
             {
                 var message = new PoisonMessage()
                 {
                     Info = new PoisonMessageInfo()
                     {
                         MessageId      = reader.GetGuid(0),
                         InsertDateTime = reader.GetDateTime(1),
                         Queue          = reader.GetString(2),
                         QueueService   = reader.GetString(3),
                         OriginService  = reader.GetString(4),
                     },
                     Message          = reader.GetString(5) ?? string.Empty,
                     ExceptionMessage = reader.GetString(6) ?? string.Empty,
                 };
                 return(message);
             }
             return(null);
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets a single Poison Message, including message body and exception details.
 /// </summary>
 public static PoisonMessage GetPoisonMessage(this IDbConnection connection, Guid messageId)
 {
     using (var cmd = connection.CreateCommand())
     {
         var param = cmd.CreateParameter();
         param.ParameterName = "@messageId";
         param.Value = messageId;
         param.DbType = DbType.Guid;
         cmd.Parameters.Add(param);
         cmd.CommandText = Query_PosionMessage;
         using (var reader = cmd.ExecuteReader())
         {
             while (reader.Read())
             {
                 var message = new PoisonMessage()
                 {
                     Info = new PoisonMessageInfo()
                     {
                         MessageId = reader.GetGuid(0),
                         InsertDateTime = reader.GetDateTime(1),
                         Queue = reader.GetString(2),
                         QueueService = reader.GetString(3),
                         OriginService = reader.GetString(4),
                     },
                     Message = reader.GetString(5) ?? string.Empty,
                     ExceptionMessage = reader.GetString(6) ?? string.Empty,
                 };
                 return message;
             }
             return null;
         }
     }
 }