Add Queue to Dependency Injection (Optimize)
This commit is contained in:
parent
c0749bdc20
commit
cf7a79166a
3 changed files with 116 additions and 33 deletions
24
BMA.EHR.Leave/Services/RabbitCheckInService.cs
Normal file
24
BMA.EHR.Leave/Services/RabbitCheckInService.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using RabbitMQ.Client;
|
||||
using System.Text;
|
||||
|
||||
namespace BMA.EHR.Leave.Service.Services
|
||||
{
|
||||
public class RabbitCheckInService
|
||||
{
|
||||
private readonly IModel _channel;
|
||||
|
||||
public RabbitCheckInService(IModel channel)
|
||||
{
|
||||
_channel = channel;
|
||||
}
|
||||
|
||||
public void SendMessageToQueue(string queueName, byte[] body)
|
||||
{
|
||||
//var body = Encoding.UTF8.GetBytes(message);
|
||||
_channel.BasicPublish(exchange: "",
|
||||
routingKey: queueName,
|
||||
basicProperties: null,
|
||||
body: body);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue