当前位置:   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博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/994141
推荐阅读
相关标签
  

闽ICP备14008679号