diff --git a/BMA.EHR.CheckInConsumer/Program.cs b/BMA.EHR.CheckInConsumer/Program.cs index 4d8323f4..1a5a68d1 100644 --- a/BMA.EHR.CheckInConsumer/Program.cs +++ b/BMA.EHR.CheckInConsumer/Program.cs @@ -16,6 +16,7 @@ WriteToConsole("Consumer Start!"); var host = configuration["Rabbit:Host"] ?? ""; var user = configuration["Rabbit:User"] ?? ""; var pass = configuration["Rabbit:Password"] ?? ""; +var queue = configuration["Rabbit:Queue"] ?? "basic-queue"; // create connection var factory = new ConnectionFactory() @@ -29,7 +30,8 @@ var factory = new ConnectionFactory() using var connection = factory.CreateConnection(); using var channel = connection.CreateModel(); -channel.QueueDeclare(queue: "bma-checkin-queue", durable: true, exclusive: false, autoDelete: false, arguments: null); +//channel.QueueDeclare(queue: "bma-checkin-queue", durable: true, exclusive: false, autoDelete: false, arguments: null); +channel.QueueDeclare(queue: queue, durable: true, exclusive: false, autoDelete: false, arguments: null); var consumer = new EventingBasicConsumer(channel); @@ -59,7 +61,8 @@ consumer.Received += async (model, ea) => //WriteToConsole($"ตอบกลับจาก REST API: {JsonConvert.SerializeObject(item)}"); }; -channel.BasicConsume(queue: "bma-checkin-queue", autoAck: true, consumer: consumer); +//channel.BasicConsume(queue: "bma-checkin-queue", autoAck: true, consumer: consumer); +channel.BasicConsume(queue: queue, autoAck: true, consumer: consumer); //Console.WriteLine("\nPress 'Enter' to exit the process..."); diff --git a/BMA.EHR.CheckInConsumer/appsettings.json b/BMA.EHR.CheckInConsumer/appsettings.json index 2cb51e69..b180f90c 100644 --- a/BMA.EHR.CheckInConsumer/appsettings.json +++ b/BMA.EHR.CheckInConsumer/appsettings.json @@ -2,7 +2,8 @@ "Rabbit": { "Host": "192.168.1.40", "User": "admin", - "Password": "Test123456" + "Password": "Test123456", + "Queue": "bma-checkin-queue" }, "API": "https://localhost:7283/api/v1" } \ No newline at end of file