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

惠州seo招聘seo引擎优化工具

惠州seo招聘,seo引擎优化工具,对政府网站建设的几点要求,宁波做网站的大公司有哪些社交电商平台源码请加企鹅求求:一零三八七七四六二六。spring cloud是按照spring的配置对一系列微服务框架的集成,spring cloud bus是其中一个微服务框架,用于实现微服务之间的通信。 spring cloud bus整合 java的事件处理机制和消息中间件消…

社交电商平台源码请加企鹅求求:一零三八七七四六二六。spring cloud是按照spring的配置对一系列微服务框架的集成,spring cloud bus是其中一个微服务框架,用于实现微服务之间的通信。

spring cloud bus整合 java的事件处理机制和消息中间件消息的发送和接受,主要由发送端、接收端和事件组成。针对不同的业务需求,可以设置不同的事件,发送端发送事件,接收端接受相应的事件,并进行相应的处理。

2、原理

spring cloud bus整合了java的事件处理机制和消息中间件,所以下面就从这两个方面来说明spring cloud bus的原理。

如图所示,作如下解释:

(1)完整流程:发送端(endpoint)构造事件event,将其publish到context上下文中(spring cloud bus有一个父上下文,bootstrap),然后将事件发送到channel中(json串message),接收端从channel中获取到message,将message转为事件event(转换过程这一块没有深究),然后将event事件publish到context上下文中,最后接收端(Listener)收到event,调用服务进行处理。整个流程中,只有发送/接收端从context上下文中取事件和发送事件是需要我们在代码中明确写出来的,其它部分都由框架封装完成。

(2)先大致描述了一下流程,关于封装的部分流程,我们基本上可以在BusAutoConfiguration.class中找到,下面的代码都是这个类中的代码

  @EventListener(classes = RemoteApplicationEvent.class)public void acceptLocal(RemoteApplicationEvent event) {if (this.serviceMatcher.isFromSelf(event)&& !(event instanceof AckRemoteApplicationEvent)) {this.cloudBusOutboundChannel.send(MessageBuilder.withPayload(event).build());}}
复制代码

这是封装了java事件处理机制,当收到RemoteApplicationEvent时,如果这个event是从这个服务发出的,而且不是ack事件,那么就会把这个事件发送到channel中。

  @StreamListener(SpringCloudBusClient.INPUT)public void acceptRemote(RemoteApplicationEvent event) {if (event instanceof AckRemoteApplicationEvent) {if (this.bus.getTrace().isEnabled() && !this.serviceMatcher.isFromSelf(event)&& this.applicationEventPublisher != null) {this.applicationEventPublisher.publishEvent(event);}// If it's an ACK we are finished processing at this pointreturn;}if (this.serviceMatcher.isForSelf(event)&& this.applicationEventPublisher != null) {if (!this.serviceMatcher.isFromSelf(event)) {this.applicationEventPublisher.publishEvent(event);}if (this.bus.getAck().isEnabled()) {AckRemoteApplicationEvent ack = new AckRemoteApplicationEvent(this,this.serviceMatcher.getServiceId(),this.bus.getAck().getDestinationService(),event.getDestinationService(), event.getId(), event.getClass());this.cloudBusOutboundChannel.send(MessageBuilder.withPayload(ack).build());this.applicationEventPublisher.publishEvent(ack);}}if (this.bus.getTrace().isEnabled() && this.applicationEventPublisher != null) {// We are set to register sent events so publish it for local consumption,// irrespective of the originthis.applicationEventPublisher.publishEvent(new SentApplicationEvent(this,event.getOriginService(), event.getDestinationService(),event.getId(), event.getClass()));}}
复制代码

@StreamListener这个标签有兴趣的可以去了解一下。这个方法就是从channel中取出事件进行处理的过程(message转事件部分需要自行了解,我没有深入研究),根据事件的类型、发送方和接收方来处理这个事件:如果是ack事件,发送到context上下文中;如果自己是接收端且不是发送端,就会将事件发送到context上下文。

(3)消息中间件可以采用rabbitmq、kafka之类的。

转载于:https://juejin.im/post/5cd389985188257707362edc

http://www.wooajung.com/news/33909.html

相关文章:

  • 网站做营销推广的公司产品推广思路
  • 企业网站网站建设电话营销型企业网站诊断
  • 贵州网站建设公司有哪些seo推广是什么意怿
  • 禹城网站制作东莞网络营销网站建设
  • 网站建设哪些公司万网域名注册查询
  • 汕头政府网站建设报个计算机培训班多少钱
  • 丹阳网站建设多少钱北京百度总部
  • 百度网站分析工具百度一下首页网址
  • 网站建设解析汕头疫情最新消息
  • 小型公司网站建设知乎跨境电商关键词工具
  • 网站建设学生选课系统aso搜索排名优化
  • 济南哪家公司做网站好企业培训公司
  • 网络培训投诉平台重庆网站排名优化教程
  • 进服务器编辑网站怎么做中国舆情在线
  • 什么平台可以免费推广产品电商seo搜索优化
  • 昆明的房产网站建设重庆网站seo技术
  • 武汉专业做网站公司教育培训机构营销方案
  • 跟犀牛云一样做网站的无锡网站服务公司
  • 晋江网站建设报价电商营销的策略与方法
  • 做投资网站企业宣传ppt
  • 网站建设的商业目的网页设计首页
  • 企业网站建设实验感想图片外链
  • o2o网站建设报价百度输入法
  • 人力资源管理师杭州seo网站优化
  • 运城做网站费用高吗seo优化关键词是什么意思
  • 如何手机网站建立2023年最新时政热点
  • 个体户做网站是怎么备案推广营销软件app
  • 哪里有免费的网站域名推广app用什么平台比较好
  • 用jsp做新闻网站自己如何做网站
  • 珠海品牌机械网站建设常见的网络营销方法