예제 #1
0
        public void Reply(string message, IBasicProperties prop)
        {
            //Выходим, если prop.ReplyTo пустой
            if (prop.ReplyTo == null || prop.ReplyTo == "")
            {
                return;
            }

            byte[] body = Encoding.UTF8.GetBytes(message);
            try
            {
                this.channel.BasicPublish(exchange: this.ExchangeName,
                                          routingKey: prop.ReplyTo,
                                          basicProperties: prop,
                                          body: body);
            }
            catch (System.ArgumentNullException ex)
            {
                string mess = ex.Message + " throw in Reply()! exchange=" + this.ExchangeName +
                              ", routingKey=" + prop.ReplyTo +
                              ", basicProperties=" + prop.ToString() +
                              ", message=" + message;
                throw new RabbitMQTOMSSQLExeption(mess);
            }
        }