Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var factory = new ConnectionFactory(){ HostName = _rabbitMQ_Hostname, UserName = _rabbitMQ_Username, Password = _rabbitMQ_Password};
- using (var connection = factory.CreateConnection())
- using (var channel = connection.CreateModel())
- {
- channel.QueueDeclare(queue: _autoCancellationPNS_QueueName,
- durable: true,
- exclusive: false,
- autoDelete: false,
- arguments: null);
- string message = appointmentId.ToString();
- var body = Encoding.UTF8.GetBytes(message);
- IBasicProperties properties = channel.CreateBasicProperties();
- properties.DeliveryMode = 2;
- channel.BasicPublish(exchange: _rabbitMQ_Exchange,
- routingKey: _autoCancellationPNS_RoutingKey,
- basicProperties: properties,
- body: body);
- returnMessage.ShortMessage = "Added to queue";
- returnMessage.LongMessage = "Added to queue";
- logger.Debug("|Added to queue");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement