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); }
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); }
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); }