forked from Alexey/DAS_2024_1
23 lines
830 B
C#
23 lines
830 B
C#
using ConsumerSimple;
|
|
|
|
var rabbitHost = Environment.GetEnvironmentVariable("RABBIT_HOST") ?? "localhost";
|
|
var rabbitUsername = Environment.GetEnvironmentVariable("RABBIT_USERNAME") ?? "user";
|
|
var rabbitPassword = Environment.GetEnvironmentVariable("RABBIT_PASSWORD") ?? "password";
|
|
var rabbitExchange = Environment.GetEnvironmentVariable("RABBIT_EXCHANGE") ?? "ReportIn";
|
|
var rabbitQueue = Environment.GetEnvironmentVariable("RABBIT_QUEUE") ?? "First";
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
var receiver = new Receiver(rabbitHost, rabbitUsername, rabbitPassword);
|
|
|
|
receiver.SubscribeTo(rabbitExchange, (message) =>
|
|
{
|
|
var rnd = new Random();
|
|
|
|
Console.WriteLine($"Пришло сообщение: {message}");
|
|
|
|
Console.WriteLine($"Сообщение обрабатывается мгновенно");
|
|
},
|
|
rabbitQueue);
|
|
|
|
while (true) ; |