Exemplo n.º 1
0
 /// <summary>
 /// Populates RabbitMQ header properties with the current MessageHeader
 /// </summary>
 /// <param name="headers"></param>
 public void Populate(IDictionary <string, object> headers)
 {
     headers.Add("MessageGuid", MessageGuid.ToString());
     headers.Add("ProducerProcessID", ProducerProcessID);
     headers.Add("ProducerExecutableName", ProducerExecutableName);
     headers.Add("OriginalPublishTimestamp", OriginalPublishTimestamp);
     headers.Add("Parents", string.Join(Splitter, Parents));
 }
Exemplo n.º 2
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = MessageGuid.GetHashCode();
         hashCode = (hashCode * 397) ^ ProducerProcessID;
         hashCode = (hashCode * 397) ^ (ProducerExecutableName != null ? ProducerExecutableName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ OriginalPublishTimestamp.GetHashCode();
         // NOTE(rkm 2020-03-04) GetHashCode for a struct[] uses reference equality, so instead we compute the hash
         //                      code using the string representation of the Parents array
         hashCode = (hashCode * 397) ^ (Parents != null ? string.Join(Splitter, Parents).GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 3
0
        public void Log(ILogger logger, LogLevel level, string message, Exception ex = null)
        {
            //TODO This is massively over-logging - ProducerProcessID, ProducerExecutableName, OriginalPublishTimestamp are found in the logs anyway
            var theEvent = new LogEventInfo(level, logger.Name, message);

            theEvent.Properties["MessageGuid"]              = MessageGuid.ToString();
            theEvent.Properties["ProducerProcessID"]        = ProducerProcessID;
            theEvent.Properties["ProducerExecutableName"]   = ProducerExecutableName;
            theEvent.Properties["OriginalPublishTimestamp"] = OriginalPublishTimestamp;
            theEvent.Properties["Parents"] = string.Join(Splitter, Parents);
            theEvent.Exception             = ex;

            logger.Log(theEvent);
        }
Exemplo n.º 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = MessageGuid.GetHashCode();
         hashCode = (hashCode * 397) ^ ExtractionJobIdentifier.GetHashCode();
         hashCode = (hashCode * 397) ^ ProducerExecutableName.GetHashCode();
         hashCode = (hashCode * 397) ^ ProducerProcessID;
         hashCode = (hashCode * 397) ^ OriginalPublishTimestamp.GetHashCode();
         hashCode = (hashCode * 397) ^ (Parents != null ? Parents.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ReceivedAt.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 5
0
 /// <inheritdoc />
 public bool Equals(MessageHeader other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(MessageGuid.Equals(other.MessageGuid) &&
            ProducerProcessID == other.ProducerProcessID &&
            string.Equals(ProducerExecutableName, other.ProducerExecutableName) &&
            OriginalPublishTimestamp == other.OriginalPublishTimestamp &&
            Parents.SequenceEqual(other.Parents));
 }
Exemplo n.º 6
0
 public bool Equals(MongoExtractionMessageHeaderDoc other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(ExtractionJobIdentifier.Equals(other.ExtractionJobIdentifier) &&
            MessageGuid.Equals(other.MessageGuid) &&
            ProducerExecutableName == other.ProducerExecutableName &&
            ProducerProcessID == other.ProducerProcessID &&
            OriginalPublishTimestamp.Equals(other.OriginalPublishTimestamp) &&
            Parents == other.Parents &&
            ReceivedAt.Equals(other.ReceivedAt));
 }