当前位置: 首页 > news >正文

C# Microsoft消息队列服务器的使用 MSMQ

先安装消息队列服务器
在这里插入图片描述

 private static readonly string path = ".\\Private$\\myQueue";private void Create(){if (!MessageQueue.Exists(path)){MessageQueue.Create(path);}}private void Send(){Stopwatch stopwatch = new Stopwatch();stopwatch.Start();MessageQueue myQueue = new MessageQueue(path);myQueue.Send(textBox1.Text);stopwatch.Stop();}private void Display(){Task.Run(() =>{MessageQueue rcvMyQueue=new MessageQueue(path);rcvMyQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });while (true){var message = rcvMyQueue.Receive();listBox1.BeginInvoke(new Action(() =>{listBox1.Items.Add(DateTime.Now.ToString("HH:mm:ss.fff")+":"+message.Body.ToString());}));}});}private void Form1_Load(object sender, EventArgs e){Create();Display();}
http://www.lryc.cn/news/106863.html

相关文章:

  • Kafka3.0.0版本——生产者如何提高吞吐量
  • js精度丢失的问题
  • C++ 编译预处理
  • 备战秋招 | 笔试强化22
  • LeetCode ACM模式——哈希表篇(二)
  • hadoop 3.1.3集群搭建 ubuntu20
  • 备忘录模式——撤销功能的实现
  • Golang 函数参数的传递方式 值传递,引用传递
  • K8s影响Pod调度和Deployment
  • 透明代理和不透明代理
  • 1424. 对角线遍历 II;2369. 检查数组是否存在有效划分;1129. 颜色交替的最短路径
  • 【漏洞复现】Metabase 远程命令执行漏洞(CVE-2023-38646)
  • Linux 9的repo for OVS build
  • DOCTYPE 是什么作用?
  • KubeSphere 3.4.0 发布:支持 K8s v1.26
  • 自然语言文本分类模型代码
  • Prometheus实现系统监控报警邮件
  • could not import go.etcd.io/etcd/clientv3-go
  • MySQL的行锁、表锁触发
  • mysql-入门笔记-3
  • 3分钟创建超实用的中小学新生录取查询系统,现在可以实现了
  • Redis 变慢了 解决方案
  • 远程仓库的操作
  • 一个监控系统的典型架构
  • 让GPT人工智能变身常用工具-中
  • HCIP中期实验
  • 《向量数据库指南》——向量数据库Milvus Cloud、Pinecone、Vespa、Weaviate、Vald、GSI 、 Qdrant选哪个?
  • python与深度学习(十一):CNN和猫狗大战
  • 经典CNN(三):DenseNet算法实战与解析
  • 学习笔记——压力测试案例,监控平台