当前位置: 首页 > 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/14564170/

相关文章:

  • 公司网站内容更新该怎么做肥城网站建设哪家好
  • 公司的官方网站的作用网站建设合同规范
  • 今天开始做魔王免费观看网站开发公司是什么
  • 网站服务器租用有什么好织梦如何做移动网站
  • 阳光家园广州网站为网站做seo
  • 北京网站优化公司哪里稳定天空在线网站建设
  • nginx 网站开发人才网站的会计账如何做
  • 做设计有哪些接私活的网站长沙市城市建设档案馆网站
  • 哪个网站企业邮箱最好怎么制作一个游戏app
  • 用python做 网站论坛如何在word里做网站
  • 网站开发设计总结上海开发小程序
  • 最大的开源网站天津seo建站
  • 网站建设属于现代服务吗三合一网站一般多少钱
  • 福清网站建设专家xp做网站
  • 宁夏高端网站建设创建自己网站的步骤
  • 校考前做试题的网站培训网站源码wordpress
  • 哪个网站做数学题赚钱宁波建设检测
  • 公司网站SEO优化哪个做得好做外贸学习网站
  • 做婚纱的网站网站程序设置主页面
  • 东莞市建设网站首页设计学分类
  • owasp 网站开发wordpress播放
  • 专业网站开发服务如何宣传推广自己的产品
  • 企业如何应用网站的怎么做平台网站
  • 什么都能买到的网站wordpress option
  • 吴川网站建设公司深圳小程序推广
  • 怎么自己免费创建网站广州网站建设骏域
  • 深圳开发公司网站建设wordpress调用指定分类的文章列表
  • 花网站开发背景建设网站需要的人才
  • 建设一个商业网站费用做采购 通常在什么网站看
  • 医药招商网站建设网站设置子目录