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

门户网站开发 价格中国企业500强2022

门户网站开发 价格,中国企业500强2022,网站设计需要考虑哪些基本原则,wordpress 运营商广告消息队列: 组成: 交换器,队列,绑定 作用:异步处理,削峰,服务解耦 交换器 RabbitMQ常见的exchange(交换器)类型: direct–路由键完全匹配才可以 fanout–广播 topic --主题,模糊匹配路由键 队列 messagequeue: 组成: 路由键 routine-key—决定消息发给谁 优先级prio… 消息队列: 组成: 交换器,队列,绑定 作用:异步处理,削峰,服务解耦 交换器 RabbitMQ常见的exchange(交换器)类型: direct–路由键完全匹配才可以 fanout–广播 topic --主题,模糊匹配路由键 队列 messagequeue: 组成: 路由键 routine-key—决定消息发给谁 优先级priority–决定消息发送的优先级 分发模式deliver-mode–决定消息的发送方式–持久化等 绑定 binding: 依赖 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-amqp/artifactIdversion2.6.4/version/dependency配置文件: spring:rabbitmq:username: zzypassword: 1234host: 172.24.232.166注册队列: Configuration public class RabbitConfig {Beanprotected Queue queue(){Queue queue new Queue(zzy);return queue;} }生产者发送消息 //作为信息的发布者 SpringBootTest(classes ApplicationRabbitMq.class) public class RabbitTest {//Amqp模板类Autowiredprivate AmqpTemplate amqpTemplate;Testvoid RabbitTest(){amqpTemplate.convertAndSend(zzy,hello world);System.out.println(success);} }消费者消费消息: Component //加注解,不然无法解析 public class RabbitMqConsumer {RabbitListener(queues zzy)//订阅的队列public void Listened1(String msg){System.out.println(取出的消息1----msg);}RabbitListener(queues zzy)public void Listened2(String msg){System.out.println(取出的消息2----msg);} }默认使用direct队列,如果要使用广播队列: 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;Configuration public class RabbitFanoutConfig {//准备两个队列Beanprotected Queue queue() {return new Queue(gavin);}Beanprotected Queue queue2() {return new Queue(zzy);}//内置fanout交换器名称amq.fanoutBeanprotected FanoutExchange fanoutExchange() {return new FanoutExchange(amq.fanout);}//将交换器和队列绑定Beanprotected Binding fanoutBinding(Queue queue, FanoutExchange fanoutExchange) {return BindingBuilder.bind(queue).to(fanoutExchange);}Beanprotected Binding fanoutBinding2(Queue queue2, FanoutExchange fanoutExchange) {return BindingBuilder.bind(queue2).to(fanoutExchange);} }一个交换器可以绑定多个队列; 几个重要的注解/Bean import org.springframework.amqp.core.AmqpTemplate; Bean AmqpTemplate amqpTemplate //此模板中有发送消息的方法------------------------------------- import org.springframework.amqp.core.Queue; //注册一个队列directBeanprotected Queue queue() {return new Queue(gavin);}//注册一个广播交换器Beanprotected FanoutExchange fanoutExchange() {return new FanoutExchange(amq.fanout);} //交换器绑定队列//将交换器和队列绑定Beanprotected Binding fanoutBinding(Queue queue, FanoutExchange fanoutExchange) {return BindingBuilder.bind(queue).to(fanoutExchange);} //注册一个topic交换器Beanprotected TopicExchange topicExchange() {return new TopicExchange(amq.topic);} //绑定队列//将交换器和队列绑定Beanprotected Binding TopicBind1(Queue queue, TopicExchange topicExchange) {return BindingBuilder.bind(queue).to(topicExchange).with(com.gavin.*);//匹配路由规则}消费者: RabbitListener(queues gavin)该方法从对列中消费消息消息重复消费原因: 消费完毕后本该向broker发送ack,但是由于网路延迟较高过了broker等待的时间,于是broker会把消息再次投递到consumer 解决方案: 数据库—处理消息前,使用消息主键在表中带有约束的字段中insert,插入成功则消费成功,插入失败则已经消费过了,不再进行消费 Map–单机版的使用ConrrentHashMap -putifAbsent Redis --分布式锁 保证消息队列的消费顺序 同一个topic,同一个queue,发的时候让一个线程去发,消费的时候让一个线程去消费,如果多线程暂时无法保证消费的有序性 怎么保证消息发送到同一个queue? RocketMQ 提供了一个MessageQueueSelector 接口,重写接口方法 RocketMQ如何保证消息不丢失 Producer端: 采用send()同步发消息,发送结果是同步感知的; Broker端: 设置数显策略为同步刷新策略 集群部署,配置主从,高可用模式 Consumer端: 消费正常后再进行手动ACK确认
http://www.zqtcl.cn/news/220400/

相关文章:

  • 药品网站订单源码外贸网站建设服务器
  • 深圳网站制作07551免费开发网站
  • 如何直接用jsp做网站不写servletwordpress模板 单栏
  • 长沙网站建设哪个公司好设计公司网站 唐山
  • 原创小说手机网站制作需要多少钱郴州seo外包
  • 深圳市大鹏建设局网站网站关键词没排名怎么办
  • 水果商城网站制作多少钱c#如何做公司网站
  • 国内做进口的电商网站网站建设的经验做法
  • 蚂蚁搬家公司官方网站免费网站软件制作
  • 搭建网站要用到的工具外链代发免费
  • 肥城网站建设流程oem中国代加工网
  • 到底建手机网站还是电脑网站网站视频怎么做
  • 小区网站建设前端手机网站
  • 做一个网站价格WordPress好看的404
  • 查看注册过的网站在线网站软件免费下载
  • 门户网站建设公司价位域名出售网站
  • 亿级流量网站架构自己制作一个网站
  • 企业网站seo成功案例天津网站建设制作品牌公司
  • 衡水做网站电话郏县建设局网站
  • 美工做网站尺寸多少钱怎么做网站免费的
  • 会计信息系统网站建设流程图手机网站图片宽度
  • 已备案网站增加域名wordpress 百度熊掌号
  • 网站建设维护课件ppt百度搜索一下百度
  • 重庆企业网站开发方案wordpress菜单插件
  • 江苏网站seo设计什么学习网站建设
  • 青海网站建设系统电商出口营销要多少钱
  • 上海的网站设计公司百度上做优化
  • 连云港权威网站优化服务如何自己做解析网站
  • 学校网站建设调研报告wordpress update_post_meta
  • 法人变更在哪个网站做公示做企业平台的网站有哪些