每个项目的都有各自的场景,但是其实往小处说,场景的处理基本都是很相似,之前做copy文件的程序,其实就是一种很常见的ETL的过程(转移文件,异构系统通过文件系统交换数据,存在数据同步)。

了解一下ETL:就是数据转移的一个处理过程(A库与B库之间进行数据抽取)---最重要就是格式的转换。

了解一下ESB,专门的数据处理中心的平台系统(建立一个数据中心,对外提高数据服务)。

开源ESB平台:Mule,Spring Intergation

       数据源:DB,FTP,File,Socket,HTTP,JMS

==============================================================================================

mule例子:拷贝文件

File数据源:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<file:connector name="FileConnector" streaming="true"
pollingFrequency="5000">
<file:expression-filename-parser />
</file:connector>
<model name="FileDataChange">
<service name="fileService">
<inbound>
<file:inbound-endpoint path="c:/data/snapshot" />
</inbound>
<outbound>
<pass-through-router>
<file:outbound-endpoint path="c:/data/archive" outputPattern="#[message.inboundProperties['originalFilename']]"/>
</pass-through-router>
</outbound>
</service>
</model>
</mule>
概念:连接器、端点、轮询器(队列轮询机制)
控制台数据源
---------------------------------------------------------------------------------------------------------------------------------------------------
Spring integration配置文件例子(借鉴cafe例子写)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/file
http://www.springframework.org/schema/integration/file/spring-integration-file.xsd"> <!-- Spring 框架组件的挂节点(gateway,spliter,fliter,transformer,router,service-activator,aggregator,adapter,channel) -->
<bean id="tools" class="com.yyb.test.ite.OrderTools"></bean> <!-- 轮询器 -->
<int:poller id="poller" default="true" fixed-rate="1000"/> <!-- 数据采集的源端 -->
<int:gateway id="cafe" service-interface="com.yyb.test.ite.IOrderService" /> <!-- 数据采集的通道 -->
<int:channel id="orders" /> <int:header-enricher input-channel="orders" output-channel="addHeader_orders" >
<int:header name="type" value="cofe_china"/>
</int:header-enricher>
<int:channel id="addHeader_orders" /> <int:filter input-channel="addHeader_orders" output-channel="after_orders" ref="tools" method="filterOrder"/> <int:channel id="after_orders" /> <!-- 通道数据的切割器 -->
<int:splitter input-channel="after_orders" ref="tools"
method="spliteOrder" output-channel="drinks" /> <!-- 第二个数据通道 -->
<int:channel id="drinks"/> <!-- 通道数据路由器 -->
<int:router input-channel="drinks" ref="tools"
method="routerOrder" /> <!-- 通道一 -->
<int:channel id="coldDrinks">
<int:queue capacity="10" />
</int:channel>
<!-- 挂接在通道上的服务激活器 -->
<int:service-activator input-channel="coldDrinks"
ref="tools" method="service_01" output-channel="preparedDrinks" /> <!-- 通道二 -->
<int:channel id="hotDrinks">
<int:queue capacity="10" />
</int:channel>
<!-- 挂接在通道上的服务激活器 -->
<int:service-activator input-channel="hotDrinks"
ref="tools" method="service_02" output-channel="preparedDrinks" /> <!-- 通道 -->
<int:channel id="preparedDrinks" />
<!-- 数据聚合器 -->
<int:aggregator input-channel="preparedDrinks" ref="tools"
method="completeOrder" output-channel="deliveries" /> <!-- 数据转换器 -->
<int:transformer input-channel="deliveries"
output-channel="successOrder" ref="tools" method="orderTransString"/> <!-- 输出通道 -->
<int:channel id="successOrder" /> <!-- 数据源目的端 采用文件讲数据保存 形成数据落地 -->
<int-file:outbound-channel-adapter
channel="successOrder" directory="c:/b"></int-file:outbound-channel-adapter> </beans>

//数据接收端
public interface IOrderService {
@Gateway(requestChannel="orders")
public void orderFood(Order order);
}
package com.yyb.test.ite;

import java.util.List;

import org.springframework.integration.annotation.Aggregator;
import org.springframework.integration.annotation.Filter;
import org.springframework.integration.annotation.Header;
import org.springframework.integration.annotation.Headers;
import org.springframework.integration.annotation.Payload;
import org.springframework.integration.annotation.Router;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.annotation.Splitter;
import org.springframework.integration.annotation.Transformer;

//组件挂接点(扩张点)--实现自己的业务对其组件扩展
public class OrderTools { @Transformer
public String orderTransString(@Payload Order order) {
return order.toString();
} @Filter
public boolean filterOrder(@Header String type) {
System.out.println(type);
return true;
} @Router
public String routerOrder( @Payload OrderItem order) {
System.out.println(order);
return order.getType();
} @Splitter
public List spliteOrder(Order order) {
return order.getItems();
} @Aggregator
public Order completeOrder(List<OrderItem> items) {
Order order = new Order();
order.setUserName("tty");
order.setOrderName("ppi");
order.setItems(items);
return order;
}

  //挂接自己的业务实现
@ServiceActivator
public OrderItem service_01(@Payload OrderItem orderItem) {
System.out.println("service_01=" + orderItem.toString());
return orderItem;
}

   //挂接自己的业务实现
@ServiceActivator
public OrderItem service_02(@Payload OrderItem orderItem) {
System.out.println("service_02=" + orderItem.toString());
return orderItem;
} @Transformer
public OrderItem transStringToObject(@Payload OrderItem order) {
return null;
}
}

public class Order {

    private String orderName;
private String orderId;
private String userName; private List<OrderItem> items;
}
public class OrderItem { private String name;
private String type;
}
//省略get set

public static void main(String[] args) {

        ApplicationContext context = new ClassPathXmlApplicationContext("spring-cafe.xml");
IOrderService service = (IOrderService) context.getBean("cafe"); Order order = new Order();
order.setUserName("yyg");
order.setOrderName("一份辣子鸡");
order.setOrderId("001"); OrderItem item01 = new OrderItem();
item01.setName("鸡汤一碗");
item01.setType("coldDrinks"); OrderItem item02 = new OrderItem();
item02.setName("一知排骨");
item02.setType("hotDrinks"); List<OrderItem> items = new ArrayList<OrderItem>(); items.add(item01);
items.add(item02); order.setItems(items); service.orderFood(order );//添加数据到通道 }
 

ESB初步配置文件认识的更多相关文章

  1. Shuttle ESB实现消息推送

    ESB全称Enterprise Service Bus,即企业服务总线.它是传统中间件技术与XML.Web服务等技术结合的产物. ESB的出现改变了传统的软件架构,能够提供比传统中间件产品更为便宜的解 ...

  2. 关于MTK平台SIM-ME Lock的配置方案

    针对一些运营商的锁网需求,MTK平台已经对其有很好的支持.绝大多数的海外需求可以通过直接配置相关文件来完成.这里简单描述一下配置方法,不做原理分析. 相关数据结构分析: Modem中与SML锁网配置相 ...

  3. 对EBS中配置文件的初步认识

    配置文件(PROFILE)在EBS系统配置占有很重要的位置,功能顾问要对很多重要的配置文件做到非常熟悉才行.否则出现一个问题,可能在郁闷许久后,发觉只是某个不起眼的配置文件在捣乱.配置文件相当于带有权 ...

  4. Nginx入门讲解——初步认识了解nginx.conf配置文件以及配置多个虚拟主机

    本文引自网络进攻学习之用https://blog.csdn.net/weixin_38111957/article/details/81080539 一. 引言上节文章讲述了如何用信号控制Nginx服 ...

  5. Linux系统的vim编辑器的配置文件的初步说明

    vim 编辑器的基本说明 vi编辑器的功能类似于Windows下的记事本,只能编辑普通文本,而vim编辑器则相当于Windows下的notepad++等高级编辑器,提升了代码开发效率. 将vi命令默认 ...

  6. lwip【5】 lwIP配置文件opt.h和lwipopts.h初步分析之二

    如何去配置lwip,使它去适合不同大小的脚,这就是本贴的主题lwIP的配置问题.尤其是内存的配置,配置多了浪费,配置少了跑不了或者不稳定(会出现的一大堆莫名奇妙的问题,什么打开网页的速度很慢啊?什么丢 ...

  7. lwip【4】 lwIP配置文件opt.h和lwipopts.h初步分析之一

    在这里先说一下这两个配置lwip协议栈文件opt.h和lwipopts.h的关系:          opt.h是lwip"出厂"时原装的配置文件,它的作者是瑞士科学院的Adam等 ...

  8. ssh整合思想初步 struts2与Spring的整合 struts2-spring-plugin-2.3.4.1.jar下载地址 自动加载Spring中的XML配置文件 Struts2下载地址

    首先需要JAR包 Spring整合Structs2的JAR包 struts2-spring-plugin-2.3.4.1.jar 下载地址 链接: https://pan.baidu.com/s/1o ...

  9. 初步了解Shuttle ESB

    ESB:EnterpriseService Bus,即企业服务总线.它是传统中间件技术与XML.Web服务等技术结合的产物.从面向服务体系架构发展而来. ESB採用了"总线"这种模 ...

随机推荐

  1. encodeURI、encodeURIComponent、decodeURI、decodeURIComponent的区别

    一.这四个方法的用处 1.用来编码和解码URI的 统一资源标识符,或叫做 URI,是用来标识互联网上的资源(例如,网页或文件)和怎样访问这些资源的传输协议(例如,HTTP 或 FTP)的字符串.除了e ...

  2. ubuntu16上传文件到服务器

    用windows时候,上传文件到服务器,一般都是用xshell和xftp配合使用,用ubuntu就不需要额外安装任何软件了.只用ctrl+alt+t,打开命令行用一句话就可以上传了. 将本地war包上 ...

  3. MyEclipse10 添加反编译JadClipse插件

    工具/原料   MyEclipse10.0.7+net.sf.jadclipse_3.3.0.jar+jad.exe net.sf.jadclipse_3.3.0.jar+jad.exe下载地址:ht ...

  4. SIM800C Couldn't pair with xxx because of an incorrect PIN or passkey

    /******************************************************************************* * SIM800C Couldn't ...

  5. Win7不能用鼠标双击运行jar文件怎么办?

    Java应用程序jar文件可以由 JVM(Java虚拟机)直接执行,只要操作系统安装了JVM便可以运行作为Java应用程序的jar文件,其跨平台特性使得很多工具软件都用jar方式来部署分发,比如用于H ...

  6. 多边形面积问题(hdoj2036)

    杭电oj2036http://acm.hdu.edu.cn/showproblem.php?pid=2036 计算几何,求多边形的面积 只要记住这个公式: 如果逆时针给出点坐标,值为正, 如果顺时针给 ...

  7. makefile,让编译更简单

    陈皓 (CSDN) 概述—— 什么是makefile?或许很多Winodws的程序员都不知道这个东西,因为那些Windows的IDE都为你做了这个工作,但我觉得要作一个好的和professional的 ...

  8. 偶尔用得上的Git操作

    Git 工作流 一个不错的工作流图示 创建一个空分支 git checkout --orphan 分支名 删除远程分支和tag git push origin :<branchName> ...

  9. 如何彻底卸载Jenkins(Windows版本)

    起因: 最近在做持续集成测试过程中遇到一个问题,之前部署的Jenkins管理员密码忘了之后无法登陆,而且删除掉tomcat下webapps文件夹中的Jenkins目录后,再次安装Jenkins后相关的 ...

  10. redis 报错及解决

    报错: (error) MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persi ...