RabbitMQ provides a background management page, if you want to use this page, you need to install rabbitmq into the installation directory, run the following command cmd
rabbitmq-plugins enable rabbitmq_management
We then entered directly in the browser http: // localhost: 15672 /
Found out a landing page, the default username and password are guest, after entering the landing we can create a new account and password on their own.
Now we create a queue
Now and then we create a console project, in the project we use nuget installation RabbitMQ.Client, here I use the version is 5.0.0.0, 4.5.2 is a project framework
Then we write our code in the console
static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; using (var connection = factory.CreateConnection()) { using (var channel = connection.CreateModel()) { channel.QueueDeclare("test", true, false, false, null); var consumer = new EventingBasicConsumer(channel); consumer.Received += Consumer_Received; channel.BasicConsume("test", true, consumer); Console.ReadLine(); } } } private static void Consumer_Received(object sender, BasicDeliverEventArgs e) { var body = e.Body; var content = Encoding.UTF8.GetString(body); Console.WriteLine(content); }Then we released a message on the administration page of the browser
Click here a release, the results of the projects we run in the console has received the message