Exemple #1
0
        private static MessageItem Convert(BasicDeliverEventArgs item)
        {
            Dictionary <string, object> properties = null;

            if (item.BasicProperties.Headers != null)
            {
                properties = new Dictionary <string, object>();

                foreach ((string key, object value) in item.BasicProperties.Headers)
                {
                    properties.Add(key, value);
                }
            }

            MessageItem data = new AmqpMessageItem
            {
                Data        = item.Body.ToArray(),
                Persistent  = item.BasicProperties.Persistent,
                Exchange    = item.Exchange,
                RoutingKey  = item.RoutingKey,
                Properties  = properties,
                DeliveryTag = item.DeliveryTag
            };

            if (item.BasicProperties.IsTimestampPresent())
            {
                data.Created = DateTimeOffset.FromUnixTimeSeconds(item.BasicProperties.Timestamp.UnixTime).UtcDateTime;
            }
            return(data);
        }
Exemple #2
0
 public void Acknowledge(ICollection <MessageItem> items)
 {
     foreach (MessageItem messageItem in items)
     {
         AmqpMessageItem item = (AmqpMessageItem)messageItem;
         _channel.BasicAck(item.DeliveryTag, false);
     }
 }