Exemple #1
0
        public void Publish(string exchangeName, string exchangeRoute, string message, IIstaMessageProperties properties)
        {
            var messageProperties = MessageQueueFactory.ConvertProperties(channel, properties);
            var messagePayload    = Encoding.UTF8.GetBytes(message);

            channel.BasicPublish(exchangeName, exchangeRoute, false, false, messageProperties, messagePayload);
        }
Exemple #2
0
        public void Publish <T>(string exchangeName, string exchangeRoute, T message, IIstaMessageProperties properties)
        {
            var messageProperties = MessageQueueFactory.ConvertProperties(channel, properties);
            var messagePayload    = JsonMessageSerializer.SerializeToBytes(message);

            channel.BasicPublish(exchangeName, exchangeRoute, false, false, messageProperties, messagePayload);
        }
Exemple #3
0
        public void HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, byte[] body)
        {
            var messageProperties = MessageQueueFactory.ConvertProperties(properties);

            var correlationId = "unknown";
            var action        = "unknown";
            var type          = "unknown";

            if (messageProperties.IsCorrelationIdSet)
            {
                correlationId = messageProperties.CorrelationId;
            }

            if (messageProperties.IsMessageActionSet)
            {
                action = messageProperties.MessageAction;
            }

            if (messageProperties.IsMessageTypeSet)
            {
                type = messageProperties.MessageType;
            }

            var item = new IstaMessage
            {
                MessageId     = deliveryTag,
                Action        = action,
                Type          = type,
                CorrelationId = correlationId,
                ConsumerId    = consumerTag,
                Exchange      = exchange,
                ExchangeRoute = routingKey,
                Redelivered   = redelivered,
                Body          = body,
                Properties    = messageProperties,
            };

            queue.Enqueue(item);
        }