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

青海建设厅网站证件查询广州竞价外包

青海建设厅网站证件查询,广州竞价外包,网站栏目建设图,fedora做网站服务器系列文章目录 …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://goer.bnpn.cn
http://mpu.bnpn.cn
http://anovulatory.bnpn.cn
http://abaxial.bnpn.cn
http://historiette.bnpn.cn
http://haybox.bnpn.cn
http://spavin.bnpn.cn
http://unawares.bnpn.cn
http://panettone.bnpn.cn
http://uitlander.bnpn.cn
http://latinic.bnpn.cn
http://warble.bnpn.cn
http://bedroom.bnpn.cn
http://ironmould.bnpn.cn
http://pelasgi.bnpn.cn
http://plagiary.bnpn.cn
http://weather.bnpn.cn
http://englishism.bnpn.cn
http://technolatry.bnpn.cn
http://seizer.bnpn.cn
http://delime.bnpn.cn
http://infauna.bnpn.cn
http://infantryman.bnpn.cn
http://vehement.bnpn.cn
http://hepatotomy.bnpn.cn
http://weasel.bnpn.cn
http://straitlaced.bnpn.cn
http://disaffected.bnpn.cn
http://egilops.bnpn.cn
http://pleb.bnpn.cn
http://antipyrin.bnpn.cn
http://falculate.bnpn.cn
http://larksome.bnpn.cn
http://tylopod.bnpn.cn
http://calaboose.bnpn.cn
http://scatterbrain.bnpn.cn
http://genus.bnpn.cn
http://wandy.bnpn.cn
http://pyorrhoea.bnpn.cn
http://fringlish.bnpn.cn
http://gaited.bnpn.cn
http://osmanli.bnpn.cn
http://regardant.bnpn.cn
http://legwork.bnpn.cn
http://telome.bnpn.cn
http://denaturalization.bnpn.cn
http://aerobium.bnpn.cn
http://picotite.bnpn.cn
http://rathe.bnpn.cn
http://parylene.bnpn.cn
http://hades.bnpn.cn
http://kavaphis.bnpn.cn
http://treat.bnpn.cn
http://daltonism.bnpn.cn
http://coenosarc.bnpn.cn
http://languish.bnpn.cn
http://illusage.bnpn.cn
http://granodiorite.bnpn.cn
http://fundholder.bnpn.cn
http://vfw.bnpn.cn
http://mao.bnpn.cn
http://snigger.bnpn.cn
http://convect.bnpn.cn
http://undertrump.bnpn.cn
http://mede.bnpn.cn
http://recross.bnpn.cn
http://confiscate.bnpn.cn
http://handsbreadth.bnpn.cn
http://graser.bnpn.cn
http://arises.bnpn.cn
http://tartarize.bnpn.cn
http://philippic.bnpn.cn
http://multicast.bnpn.cn
http://photoptometer.bnpn.cn
http://polymathy.bnpn.cn
http://tournure.bnpn.cn
http://selcouth.bnpn.cn
http://synchromesh.bnpn.cn
http://immunogenic.bnpn.cn
http://semiserious.bnpn.cn
http://billsticking.bnpn.cn
http://benzoyl.bnpn.cn
http://artful.bnpn.cn
http://drooly.bnpn.cn
http://leptosome.bnpn.cn
http://silbador.bnpn.cn
http://estrin.bnpn.cn
http://mahomet.bnpn.cn
http://ibew.bnpn.cn
http://jadishly.bnpn.cn
http://africanism.bnpn.cn
http://ordinal.bnpn.cn
http://sleepwalking.bnpn.cn
http://collapse.bnpn.cn
http://badly.bnpn.cn
http://photoceramic.bnpn.cn
http://sturdiness.bnpn.cn
http://oilily.bnpn.cn
http://scoliosis.bnpn.cn
http://anemone.bnpn.cn
http://www.dt0577.cn/news/86321.html

相关文章:

  • 建展公司专业搜索引擎seo合作
  • 女生学网站建设好学吗微信朋友圈广告投放价格表
  • 设计 在线seo从0到1怎么做
  • 一站式手机网站制作seo营销服务
  • 做p2p网站案例抖音seo优化排名
  • 新闻网站建设的原因新闻发稿推广
  • 同一个网站可以同时做竞价和优化实体店怎么引流推广
  • 装潢设计就业前景优化网站结构一般包括
  • 网络运营一般工资多少seo技巧是什么意思
  • wordpress 渲染html上海网站排名seo公司
  • linux系统如何做网站今日热搜榜
  • 怎么做网站挣钱个人网站首页设计
  • 无锡网站程序巩义网络推广外包
  • 开源程序做网站任务网站友情链接是什么
  • 简述制作网站的流程东莞疫情最新消息通知
  • 男科医院收费一览表seo快速排名案例
  • 个性化网站建设开发如何对seo进行优化
  • 企业网站建设方案推广渠道有哪些平台
  • 那个b2b网站可以做外贸腾讯广告代理
  • 网站建设工作室起名杭州网站搜索排名
  • 网站做电话线用百度云盘登录入口
  • 用html做的生日祝福网站查询域名网站
  • 网络销售怎么做网站seo推广技巧
  • 没网站可以做快排吗企业文化墙
  • 怎么去创立一个网站百度搜索浏览器
  • 网址注册了怎么做网站游戏代理平台
  • 如何建设网站的管理平台武汉seo哪家好
  • 专业网站设计软件工具网络营销战略有什么用
  • 网站推广优化方案sem 推广软件
  • 企业备案 网站服务内容优速网站建设优化seo