DAS_2024_1/kuzarin_maxim_lab_4/HelloWorld/Program.cs

19 lines
457 B
C#

using HelloWorld;
string brokerHost = "localhost";
string queueName = "hello";
using var sender = new Sender(brokerHost,"user", "password", queueName);
using var receiver = new Receiver(brokerHost, "user", "password", queueName);
receiver.AddMessageHandler(text => Console.WriteLine($"Received Message from rabbit: {text}"));
Console.WriteLine("Send Message to rabbit: Hellow World!");
sender.SendMessageToQueue("Hellow World!");
while (true) ;