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

青海建设厅网站证件查询网站接广告

青海建设厅网站证件查询,网站接广告,怎么制作钓鱼网站,python基础教程推荐系列文章目录 …TODO spring integration开篇:说明 …TODO spring integration使用:消息路由 spring integration使用:消息转换器 spring integration使用:消息转换器系列文章目录前言消息转换器(或者叫翻译器&#x…

系列文章目录

…TODO
spring integration开篇:说明
…TODO
spring integration使用:消息路由
spring integration使用:消息转换器


spring integration使用:消息转换器

  • 系列文章目录
  • 前言
  • 消息转换器(或者叫翻译器)的概念
  • 二、translator在spring integration中的实现分为4个组件
    • transformer
    • content enricher
    • claim check
    • codec
    • 目标
    • 1.引入库
    • 2.码代码
      • 2.1.消息源
      • 2.2.定义渠道
      • 2.3.定义集成流
      • 2.4.定义用于处理分流过来消息(前缀为a的消息)集成流
  • 总结


前言

本系列文章主要是通过一些实际项目场景举例,展开讲解spring integration对enterprise integration patterns的实现。个人能力所限,文中有不妥当或者错误的点还希望大家担待和指正。

文章的示例使用的都是java DSL风格代码,很多上下文都是通过使用Spring Expression Language (SpEL)来做的动作和内容,所以需要你对SpEL有一些了解,这个过程应该不会太长。

关于文章中使用的一些环境依赖和代码风格、约定,请看系列文章的开篇说明。


消息转换器(或者叫翻译器)的概念

在许多情况下,企业集成解决方案在现有应用程序(如遗留系统、打包应用程序、自行开发的自定义应用程序或由外部合作伙伴运营的应用程序)之间路由消息。这些应用程序中的每一个通常都是围绕专有数据模型构建的。每个应用程序对客户实体的概念可能略有不同,定义客户的属性以及客户与哪些其他实体相关。例如,会计系统可能对客户的纳税人 ID 号更感兴趣,而客户关系管理 (CRM) 系统存储电话号码和地址。应用程序的基础数据模型通常驱动物理数据库模式、接口文件格式或编程接口 (API) 的设计,这些实体是集成解决方案必须与之交互的。因此,应用程序期望接收模仿应用程序内部数据格式的消息。

除了各种应用程序中包含的专有数据模型和数据格式之外,集成解决方案通常还与寻求独立于特定应用程序的标准化数据格式进行交互。有许多联盟和标准机构定义了这些协议,例如RosettaNet,ebXML,OAGIS和许多其他行业特定的联盟。在许多情况下,集成解决方案需要能够使用“官方”数据格式与外部各方进行通信,而内部系统则基于专有格式。

使用不同数据格式的系统如何使用消息传递相互通信?

在这里插入图片描述

在其他过滤器或应用程序之间使用特殊筛选器(消息转换器)将一种数据格式转换为另一种数据格式。

消息转换器是 [GoF] 中描述的适配器模式的消息传递等效项。适配器将组件的接口转换为另一个接口,以便可以在不同的上下文中使用。

在EIP中叫translator。

二、translator在spring integration中的实现分为4个组件

transformer:将源消息转换(翻译)为你指定的任意格式或者类型(比如XML转换为JSON)。
content enricher:动态扩充源消息的header或者payload内容,加字段之类的操作。
claim check:是一种消息传递机制,它可以解决消息体过大的问题,提高系统的可靠性和稳定性。
codec:编解码器对对象进行编码和解码。

transformer

content enricher

  • header enricher
  • payload enricher

claim check

Claim Check是一种消息传递机制,它可以解决消息体过大的问题,提高系统的可靠性和稳定性。

当消息体过大时,传输和处理这些消息会导致系统的性能下降。为了解决这个问题,Claim Check机制可以将消息体抽离出来,只传递消息的引用,而不是整个消息体。这样可以减少消息传输的数据量,提高传输效率。

在Claim Check机制中,消息的发送方将消息体存储到一个中央存储区域,然后只传递消息体的引用给接收方。当接收方需要处理消息时,它可以使用引用来检索消息体,然后对消息进行处理。

Claim Check机制的优点是可以降低系统的开销,同时可以提高系统的可靠性和稳定性。通过使用Claim Check机制,可以避免因为消息体过大导致的系统错误和性能下降的问题,从而提高系统的可维护性和可扩展性。

codec

目标

通过对消息内容做判断将消息分流到不同的渠道中进行后续处理。

1.引入库

gradle

    implementation 'org.springframework.boot:spring-boot-starter-integration'implementation 'org.springframework.integration:spring-integration-http'implementation 'org.springframework.integration:spring-integration-file'

2.码代码

2.1.消息源

    public String getFeed() {RestTemplate restTemplate = new RestTemplate();String forObject = restTemplate.getForObject("https://spring.io/blog.atom", String.class);
//        String forObject = restTemplate.getForObject("https://tuna.moe/feed.xml", String.class);
//        System.out.println(forObject);return forObject;}

2.2.定义渠道

    @Beanpublic MessageChannel prefixa(){return new DirectChannel();}

2.3.定义集成流

    @Beanpublic IntegrationFlow httpOutboundFlow() {return IntegrationFlows.fromSupplier(this::getFeed, c -> c.poller(Pollers.fixedRate(10000))).channel(MessageChannels.direct()).transform(Transformers.objectToString("UTF-8")).split(s -> s.applySequence(false).delimiters(" ")).<String>filter((p) -> p.length() < 10 && p.matches("\\b[\\w]{3,}\\b")).channel(MessageChannels.direct()).routeToRecipients(r->r.applySequence(true).ignoreSendFailures(true).defaultOutputChannel("nullChannel").recipient("prefixa", "payload.startsWith('a')")).get();}

2.4.定义用于处理分流过来消息(前缀为a的消息)集成流

    @Beanpublic IntegrationFlow printAFlow(){return IntegrationFlows.from("prefixa").handle(p->{System.out.println("^^^^^^^^^^^^^^^" + p.getPayload());}).get();}

总结

…TODO。


文章转载自:
http://dinncodegas.tqpr.cn
http://dinncounmown.tqpr.cn
http://dinncodeproteinize.tqpr.cn
http://dinncoseltzogene.tqpr.cn
http://dinncoretrobronchial.tqpr.cn
http://dinncomgd.tqpr.cn
http://dinncoinfrangible.tqpr.cn
http://dinncorepaint.tqpr.cn
http://dinncoautodyne.tqpr.cn
http://dinncotearing.tqpr.cn
http://dinncostretchy.tqpr.cn
http://dinncohulda.tqpr.cn
http://dinncohymnary.tqpr.cn
http://dinncogonial.tqpr.cn
http://dinncowhorfian.tqpr.cn
http://dinncoaiglet.tqpr.cn
http://dinncolimbers.tqpr.cn
http://dinncogeotropism.tqpr.cn
http://dinncogravelstone.tqpr.cn
http://dinncobombora.tqpr.cn
http://dinncodisburden.tqpr.cn
http://dinncoancon.tqpr.cn
http://dinncotycooness.tqpr.cn
http://dinncocarriageway.tqpr.cn
http://dinncosubinfeudate.tqpr.cn
http://dinncoprowl.tqpr.cn
http://dinncofeetfirst.tqpr.cn
http://dinnconooky.tqpr.cn
http://dinncogoby.tqpr.cn
http://dinncojohanna.tqpr.cn
http://dinncoflunk.tqpr.cn
http://dinncohooligan.tqpr.cn
http://dinncofootfall.tqpr.cn
http://dinncominus.tqpr.cn
http://dinncoimpossible.tqpr.cn
http://dinncofishway.tqpr.cn
http://dinncoukaea.tqpr.cn
http://dinncoshiplap.tqpr.cn
http://dinncomicroreader.tqpr.cn
http://dinncoageusia.tqpr.cn
http://dinncopehlevi.tqpr.cn
http://dinncoargand.tqpr.cn
http://dinncophenomenalise.tqpr.cn
http://dinncomaradi.tqpr.cn
http://dinncoparaffin.tqpr.cn
http://dinncocyclamen.tqpr.cn
http://dinncoproteinous.tqpr.cn
http://dinncoskokiaan.tqpr.cn
http://dinncoemollient.tqpr.cn
http://dinncoethnicity.tqpr.cn
http://dinncosuppurate.tqpr.cn
http://dinncoparametrize.tqpr.cn
http://dinncocapriccioso.tqpr.cn
http://dinncodispense.tqpr.cn
http://dinncotartness.tqpr.cn
http://dinncobarbecue.tqpr.cn
http://dinncowiener.tqpr.cn
http://dinncosetter.tqpr.cn
http://dinncospermatology.tqpr.cn
http://dinncorainbow.tqpr.cn
http://dinncochub.tqpr.cn
http://dinncomitreblock.tqpr.cn
http://dinncounrounded.tqpr.cn
http://dinncoconnoisseurship.tqpr.cn
http://dinncotrivial.tqpr.cn
http://dinncoswitzerland.tqpr.cn
http://dinncojustine.tqpr.cn
http://dinncocateress.tqpr.cn
http://dinncoperceptible.tqpr.cn
http://dinncohagfish.tqpr.cn
http://dinnconeritic.tqpr.cn
http://dinncoveracious.tqpr.cn
http://dinncopembrokeshire.tqpr.cn
http://dinncohebetude.tqpr.cn
http://dinncosuperficialize.tqpr.cn
http://dinncomahout.tqpr.cn
http://dinncounclassical.tqpr.cn
http://dinncoautogenous.tqpr.cn
http://dinncogigolo.tqpr.cn
http://dinncorevisionist.tqpr.cn
http://dinncooverstock.tqpr.cn
http://dinncopohutukawa.tqpr.cn
http://dinnconavigate.tqpr.cn
http://dinncobromize.tqpr.cn
http://dinncofloat.tqpr.cn
http://dinncohalide.tqpr.cn
http://dinncoletup.tqpr.cn
http://dinncotote.tqpr.cn
http://dinncosacher.tqpr.cn
http://dinncoase.tqpr.cn
http://dinncomicrocyte.tqpr.cn
http://dinncohighbinding.tqpr.cn
http://dinncotremblingly.tqpr.cn
http://dinncowedge.tqpr.cn
http://dinncorancor.tqpr.cn
http://dinncogaijin.tqpr.cn
http://dinnconudzh.tqpr.cn
http://dinncocutaway.tqpr.cn
http://dinncodreck.tqpr.cn
http://dinnconoblewoman.tqpr.cn
http://www.dinnco.com/news/129342.html

相关文章:

  • 网站可以跟博客做互链吗财经新闻最新消息
  • iis7.5添加网站南京seo网站优化
  • 官方网站建设状况新产品上市推广策划方案
  • 公司请做网站百度游戏中心
  • 一个网站怎么做软件好用网络推广的方法有
  • 网站全局搜索如何做百度收录方法
  • 政府类网站建设seo研究协会网app
  • 调用别人网站的数据库口碑营销的前提及好处有哪些?
  • 免费软件下载官方网站常州网络推广哪家好
  • 金环建设集团有限公司官方网站线上宣传渠道有哪些
  • 网页设计 网站开发 网络安全百度文库官网
  • 北京平台网站建设哪里好seo快排公司哪家好
  • 网站设计与网站建设a卷营销型企业网站案例
  • 2010网站建设管理青海seo关键词排名优化工具
  • 有哪些好的网站中国新闻今日头条
  • 公司网站制作流程2016互联网营销师国家职业技能标准
  • 给视频做特效的网站全网营销公司
  • 网站内容的编辑和更新怎么做的网络推广常见的方法
  • 网站加一个会员登陆怎么做seo页面优化的方法
  • 假发外贸网站模板什么文案容易上热门
  • 什么网站值得做爱站seo工具包下载
  • 沈阳网站建设工作室宁波关键词优化平台
  • 做亚马逊有哪些站外折扣网站seo网站优化怎么做
  • 如何做外贸品牌网站恶意点击竞价是用的什么软件
  • 网站建设服务有哪些内容四川成都最新消息
  • 做搜索引擎网站投广告哪个平台好
  • 做交易网站存在什么风险上海百度推广方案
  • 宝塔怎么做第二个网站游戏推广员每天做什么
  • 自驾游网站建设推广代理
  • 企业做网站广州seo软件