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

乡土文化网站怎么做那个网站教我做美食最好

乡土文化网站怎么做,那个网站教我做美食最好,做系统用什么网站,南昌哪家网站开发公司好发布订阅模型: MQ提供了很多交换机模型 其中常用的有下边三个: Fanout:广播 Direct:路由 Topic:话题 转换器只负责消息路由#xff0c;不是存储#xff0c;路由失败则消息丢失 Fanout Exchange:会将接收到的消息路由导每一个跟其绑定的queue. 利用SpringAMQP演示Fanout…发布订阅模型: MQ提供了很多交换机模型 其中常用的有下边三个: Fanout:广播 Direct:路由 Topic:话题 转换器只负责消息路由不是存储路由失败则消息丢失 Fanout Exchange:会将接收到的消息路由导每一个跟其绑定的queue. 利用SpringAMQP演示FanoutExchange的使用: 实现代码: 在consumer编写工具类实现交换机和队列的绑定: package cn.itcast.mq.configu;import org.springframework.amqp.core.Binding; import org.springframework.amqp.core.BindingBuilder; import org.springframework.amqp.core.FanoutExchange; import org.springframework.amqp.core.Queue; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;/*** className:cn.itcast.mq.configu.BindExchangeToQueue* description:by-li* author:Administrator* create:2024-05-1116:33*/ Configuration public class BindExchangeToQueue {//声明交换机Beanpublic FanoutExchange fanoutExchange() {return new FanoutExchange(itcast.fanout);}//生命queueBeanpublic Queue fanoutqueue1() {return new Queue(itcast.queue1);}Beanpublic Queue fanoutqueue2() {return new Queue(itcast.queue2);}//绑定交换机Beanpublic Binding fanoutExchangeToQueue1Bind(Queue fanoutqueue1, FanoutExchange fanoutExchange){return BindingBuilder.bind(fanoutqueue1).to(fanoutExchange);//绑定交换机和队列}Beanpublic Binding fanoutExchangeToQueue2Bind(Queue fanoutqueue2, FanoutExchange fanoutExchange){return BindingBuilder.bind(fanoutqueue2).to(fanoutExchange);//绑定交换机和队列}}在consumer实体类里编写接收两个队列请求的方法: RabbitListener(queues itcast.queue1)public void lintestFanoutExchangeToQueue1(String mes) throws InterruptedException {System.out.println(从队列1中获取到了消息:mes);Thread.sleep(200);}RabbitListener(queues itcast.queue2)public void lintestFanoutExchangeToQueue2(String mes) throws InterruptedException {System.out.println(从队列2中获取到了消息:mes);Thread.sleep(200);} 在publisher里编写测试方法 模拟给交换机发送消息: //给FanoutExchange交换机发送消息Testpublic void testFanoutExchangeSend(){String FanoutChangeName itcast.fanout;String msg我是fannout发送的消息;rabbitTemplate.convertAndSend(FanoutChangeName,,msg);} 然后发送请求和启动consumer类在控制台查看: 这里看到我们只发送了一条消息但是两个consumer消费者都接收到了消息能看出来Fanout Exchange交换机将收到的消息发到了给他绑定的两个queue里了 总结
http://www.hkea.cn/news/14433381/

相关文章:

  • eclipse用来做网站前端seo搜索优化试卷
  • 查网站有没有做推广永久免费win云服务器
  • 农场游戏系统开发 网站建设推广常州免费做网站
  • 网站域名备案服务外贸网络营销软件
  • 网站设计做多宽网站建设关键词优化价格
  • 马云不懂技术如何做网站写小说的小网站
  • 用织梦做房产网站网站后台seo设置
  • 鲜花网站模版网络优化工资一般多少
  • 大连做网站哪家好网站开发图片
  • 北京南昌企业网站制作网站后台怎么修改密码
  • aspnet网站开发作业手机兼职项目
  • 赶集网做网站大型建站网站
  • 做的比较好的设计公司网站wordpress支持采集吗
  • 建站网站有哪些假网站如何做
  • 采光板及采光瓦营销型网站建设怎样在网上做推广
  • 怎么建设分销模式手机网站自己可以设计装修的软件
  • 建网站在哪里做广告济南seo网站排名关键词优化
  • 瑞安机械网站建设景安服务器管理助手如何备份网站
  • 乐平城市建设局网站五屏网站建设多少钱
  • 陕西建设教育网站wordpress主题 怎么安装
  • 电子商务网站建设需要哪些步骤寓意好兆头的公司名字
  • 加强网站建设 统计局网站内页权重查询
  • 地推app推广赚佣金seo网络推广师招聘
  • 建设个网站要多少钱婚庆网站策划
  • 网站导航菜单设计网站制作实例
  • 南昌建筑行业网站开发深圳商标注册公司
  • 给缅甸公司网站做维护工作时间段没广告的视频播放器app
  • 高级建站网站网站建设首选唯美谷
  • 图列说明网站开发的流程wordpress4.5.3漏洞
  • 忻州建设厅官方网站阿里云域名拍卖