示例#1
0
        public void Publish(string message)
        {
            var rabbitMqConnection = new RabbitMqConnection();

            var channel = rabbitMqConnection.Connect();
            var body    = Encoding.UTF8.GetBytes(message);

            var properties = channel.CreateBasicProperties();

            properties.Persistent = true;

            channel.BasicPublish(Constants.Exchange, Constants.Key, true, properties, body);
            rabbitMqConnection.Disconnect();
        }
示例#2
0
 public RabbitMqConsumer()
 {
     _rabbitMqConnection = new RabbitMqConnection();
     _random             = new Random();
 }