private static void Queue_Send() { var settings = RabbitMqSettings.ForQueue( hostname: "localhost", username: "******", password: "******", port: 5672, exchange: "e.direct", queue: "q.direct"); var message = new Message { Text = "Hello Queue" }; IRabbitMqService <Message> sender = new RabbitMqService <Message>(settings); sender.Send(message); Console.WriteLine("Sent"); }
private static void Topic_Send() { var settings = RabbitMqSettings.ForTopic( hostname: "localhost", username: "******", password: "******", port: 5672, exchange: "e.topic", queue: "q.topic", routingKey: "#"); var message = new Message { Text = "Hello Topic" }; IRabbitMqService <Message> sender = new RabbitMqService <Message>(settings); sender.Send(message); Console.WriteLine("Sent"); }