Exemplo n.º 1
0
 protected IBasicProperties CreatePublishingProperties <T>(string contentType, RabbitEnvelope <T> envelope)
 {
     try
     {
         _propertyTemplate.CorrelationId         = envelope.CorrelationId;
         _propertyTemplate.MessageId             = envelope.MessageId.ToString();
         _propertyTemplate.Headers[SEQUENCE]     = envelope.Sequence;
         _propertyTemplate.Headers[SEQUENCE_END] = envelope.SequenceEnd;
         _propertyTemplate.Headers[POSITION]     = envelope.Position;
         _propertyTemplate.Headers[MESSAGE_TYPE] = envelope.MessageType.AssemblyQualifiedName;
         _propertyTemplate.ReplyToAddress        = new PublicationAddress(DIRECT_EXCHANGE, envelope.ReplyToExchange,
                                                                          envelope.ReplyToKey);
         _propertyTemplate.Timestamp = new AmqpTimestamp(DateTime.UtcNow.ToUnixTimestamp());
         return(_propertyTemplate);
     }
     catch (Exception e)
     {
         "Setting publishing properties for a Rabbit message caused an exception. \r\n\t Exchange: {0} \r\n\t MessageType: {1} \r\n\t {2}"
         .ToError <IBus>(_endpoint.ExchangeName, typeof(T).AssemblyQualifiedName, e);
     }
     return(null);
 }