当前位置:   article > 正文

[C#]RabbitMQ发送接收消息_rabbitmq c# 整合 mqtt 发送文件

rabbitmq c# 整合 mqtt 发送文件

RabbitMQ发送消息

		ConnectionFactory factory = new ConnectionFactory { HostName = "localhost", Port = 5672, UserName = "admin",Password = "ADMIN", VirtualHost = "admin" };
        using (IConnection conn = factory.CreateConnection())
        {
            using (IModel im = conn.CreateModel())
            {

                im.QueueDeclare(queue: "admin",
                                 durable: false,
                                 exclusive: false,
                                 autoDelete: false,
                                 arguments: null);

                string message = textBox1.Text;
                var sendMessage = Encoding.UTF8.GetBytes(message);
                im.BasicPublish(exchange: "",
                                 routingKey: "admin",
                                 basicProperties: null,
                               
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号