ESB的编程模型(场景)
GateWay:网关
channel:数据传输的通道
adapter:数据连接通道的数据适配器
spliter:对通道里面的数据进行分割
router:对通道进行路由
transforme:对消息进行格式化转化
service-activator:服务激活器(在通道上边挂接业务处理组件)
<?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-event="http://www.springframework.org/schema/integration/event"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
xmlns:int-groovy="http://www.springframework.org/schema/integration/groovy"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:int-httpinvoker="http://www.springframework.org/schema/integration/httpinvoker"
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd
http://www.springframework.org/schema/integration/groovy http://www.springframework.org/schema/integration/groovy/spring-integration-groovy-2.0.xsd
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event-2.0.xsd
http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.0.xsd
http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.0.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/integration/httpinvoker http://www.springframework.org/schema/integration/httpinvoker/spring-integration-httpinvoker-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 获取目录下的的包中的所有类 -->
<context:component-scan base-package="com.tjbt.hiscase.tools" />
<int:gateway id="IGetPatientInfo" service-interface="com.tjbt.hiscase.service.IGetPatientInfo"
default-request-channel="channel1">
</int:gateway>
<int:gateway id="IGetClinicInfo" service-interface="com.tjbt.hiscase.service.IGetClinicInfo"
default-request-channel="Clinicchannel1">
</int:gateway> <int:poller id="globalPoller" default="true"
max-messages-per-poll="1" cron="0-59 * * * * ?" /> <!-- 建立一个channel 即连接数据库获取到的记录的channel -->
<int:channel id="channel1">
<!-- <int:interceptors> -->
<!-- <int:wire-tap channel="logger" /> -->
<!-- </int:interceptors> -->
</int:channel> <!-- 分割一个数组 分割成一条条的记录 -->
<int:splitter id="testSplitter" input-channel="channel1"
output-channel="channel2" /> <int:splitter id="testSplitter1" input-channel="Clinicchannel1"
output-channel="Clinicchannel2" /> <int:channel id="channel2">
<int:queue capacity="10" />
</int:channel> <int:channel id="Clinicchannel2">
<int:queue capacity="10" />
</int:channel> <int:header-enricher input-channel="channel2"
output-channel="channel3">
<int:header name="exportType" value="患者住院信息" />
<int:header name="patientId" expression="payload.patientId" />
<int:header name="visitId" expression="payload.visitId" />
<int:header name="catalogDate" expression="payload.catalogDate" />
<int:header name="exportSize" expression="1" />
<int:header name="exportManner" value="manual"></int:header>
</int:header-enricher> <int:header-enricher input-channel="Clinicchannel2"
output-channel="Clinicchannel3">
<int:header name="exportType" expression="'门诊信息'+payload.visitNo" />
<int:header name="visitDate" expression="payload.visitDate" />
<int:header name="visitNo" expression="payload.visitNo" />
<int:header name="exportManner" value="auto"></int:header>
</int:header-enricher> <int:channel id="channel3">
<int:queue capacity="10" />
</int:channel> <int:channel id="Clinicchannel3">
<int:queue capacity="10" />
</int:channel> <int:filter input-channel="channel3" output-channel="channel3x"
ref="mapper" /> <int:splitter input-channel="channel3x" output-channel="channel4"
ref="DataBaseService" method="dispatch" /> <int:splitter input-channel="Clinicchannel3"
output-channel="channel4" ref="ClinicService" method="dispatch" /> <int:channel id="channel4">
<int:queue capacity="1" />
</int:channel> <int:transformer ref="mapper" input-channel="channel4"
output-channel="channel5" /> <int:publish-subscribe-channel id="channel5" > </int:publish-subscribe-channel> <!-- 把转换好的xml输出到一个目录下 -->
<!-- <int-file:outbound-channel-adapter
channel="channel5" id="filesOut" directory="D:\数据交换平台导出目录" charset="UTF-8"
filename-generator-expression="headers.get('patientId') == null ? headers.exportType + '-' + @mapper.getFileCreatedTime() +'.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId + '-' + @mapper.getFileCreatedTime() + '.xml'" />--> <!-- 把转换好的xml输出到一个目录下 -->
<int-file:outbound-channel-adapter
channel="channel5" id="filesOutbackup" directory="D:\数据交换平台导入目录"
charset="UTF-8"
filename-generator-expression="headers.get('patientId') == null ? headers.exportType + '-' + @mapper.getFileCreatedTime() +'.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId + '-' + @mapper.getFileCreatedTime() + '.xml'" /> <int:chain input-channel="channel5" output-channel="channelbl6">
<int:filter expression="headers.get('patientId') != null" />
<int:service-activator ref="AnalyseXMLService"
method="callJar">
<int:poller receive-timeout="5000" fixed-rate="1000" />
</int:service-activator>
</int:chain> <int:channel id="channelbl6">
<int:queue capacity="100" />
</int:channel> <!-- <int:chain input-channel="channelbl6" output-channel="logger">
<int:service-activator ref="blexportFile"
method="saveFile">
<int:poller receive-timeout="5000" fixed-rate="1000" />
</int:service-activator>
</int:chain> <bean id="blexportFile" class="com.tjbt.hiscase.service.ExportFile"
autowire="byType">
<property name="directory" value="D:\数据交换平台导入目录\bl"></property>
<property name="charset" value="UTF-8"></property>
<property name="filename_generator_expression"
value="headers.get('patientId') == null ? headers.exportType + '-' + '.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId + '-' + '.xml'" />
</bean> --> <!--<int-stream:stdout-channel-adapter
channel="logger" append-newline="true" />--> <int:wire-tap pattern="*" order="1" channel="logger" /> <int:channel id="logger">
<int:queue capacity="1000" />
</int:channel> <int:channel id="errorChannel">
<int:queue capacity="500" />
</int:channel>
</beans>
<?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-event="http://www.springframework.org/schema/integration/event"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
xmlns:int-groovy="http://www.springframework.org/schema/integration/groovy"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:int-httpinvoker="http://www.springframework.org/schema/integration/httpinvoker"
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd
http://www.springframework.org/schema/integration/groovy http://www.springframework.org/schema/integration/groovy/spring-integration-groovy-2.0.xsd
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event-2.0.xsd
http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.0.xsd
http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.0.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/integration/httpinvoker http://www.springframework.org/schema/integration/httpinvoker/spring-integration-httpinvoker-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 获取目录下的的包中的所有类 -->
<context:component-scan base-package="com.tjbt.hiscase.tools" />
<int:gateway id="IGetPatientInfo" service-interface="com.tjbt.hiscase.service.IGetPatientInfo"
default-request-channel="channel1">
</int:gateway>
<int:gateway id="IGetClinicInfo" service-interface="com.tjbt.hiscase.service.IGetClinicInfo"
default-request-channel="Clinicchannel1">
</int:gateway> <int:poller id="globalPoller" default="true"
max-messages-per-poll="1" cron="0-59 * * * * ?" /> <!-- 建立一个channel 即连接数据库获取到的记录的channel -->
<int:channel id="channel1">
<!-- <int:interceptors> -->
<!-- <int:wire-tap channel="logger" /> -->
<!-- </int:interceptors> -->
</int:channel> <!-- 分割一个数组 分割成一条条的记录 -->
<int:splitter id="testSplitter" input-channel="channel1"
output-channel="channel2" /> <int:splitter id="testSplitter1" input-channel="Clinicchannel1"
output-channel="Clinicchannel2" /> <int:channel id="channel2">
<int:queue capacity="10" />
</int:channel> <int:channel id="Clinicchannel2">
<int:queue capacity="10" />
</int:channel> <int:header-enricher input-channel="channel2"
output-channel="channel3">
<int:header name="exportType" value="患者住院信息" />
<int:header name="patientId" expression="payload.patientId" />
<int:header name="visitId" expression="payload.visitId" />
<int:header name="catalogDate" expression="payload.catalogDate" />
<int:header name="exportSize" expression="1" />
<int:header name="exportManner" value="manual"></int:header>
</int:header-enricher> <int:header-enricher input-channel="Clinicchannel2"
output-channel="Clinicchannel3">
<int:header name="exportType" expression="'门诊信息'+payload.visitNo" />
<int:header name="visitDate" expression="payload.visitDate" />
<int:header name="visitNo" expression="payload.visitNo" />
<int:header name="exportManner" value="auto"></int:header>
</int:header-enricher> <int:channel id="channel3">
<int:queue capacity="10" />
</int:channel> <int:channel id="Clinicchannel3">
<int:queue capacity="10" />
</int:channel> <int:filter input-channel="channel3" output-channel="channel3x"
ref="mapper" /> <int:splitter input-channel="channel3x" output-channel="channel4"
ref="DataBaseService" method="dispatch" /> <int:splitter input-channel="Clinicchannel3"
output-channel="channel4" ref="ClinicService" method="dispatch" /> <int:channel id="channel4">
<int:queue capacity="10" />
</int:channel> <int:transformer ref="mapper" input-channel="channel4"
output-channel="channel5" /> <int:publish-subscribe-channel id="channel5" /> <!-- 把转换好的xml输出到一个目录下 -->
<!-- <int-file:outbound-channel-adapter
channel="channel5" id="filesOut" directory="D:\数据交换平台导出目录" charset="UTF-8"
filename-generator-expression="headers.get('patientId') == null ? headers.exportType + '-' + @mapper.getFileCreatedTime() +'.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId + '-' + @mapper.getFileCreatedTime() + '.xml'" /> -->
<!-- 把转换好的xml输出到一个目录下 -->
<int-file:outbound-channel-adapter
channel="channel5" id="filesOutbackup" directory="D:\数据交换平台导入目录"
charset="UTF-8"
filename-generator-expression="headers.get('patientId') == null ? headers.exportType + '-' + @mapper.getFileCreatedTime() +'.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId + '-' + @mapper.getFileCreatedTime() + '.xml'" /> <int:chain input-channel="channel5" output-channel="channelbl6">
<int:filter expression="headers.get('patientId') != null" />
<int:service-activator ref="AnalyseXMLService"
method="callJar">
<int:poller receive-timeout="5000" fixed-rate="1000" />
</int:service-activator>
</int:chain> <int:channel id="channelbl6">
<int:queue capacity="100" />
</int:channel> <int:chain input-channel="channelbl6" output-channel="logger">
<int:service-activator ref="blexportFile"
method="saveFile">
<int:poller receive-timeout="5000" fixed-rate="1000" />
</int:service-activator>
</int:chain> <bean id="blexportFile" class="com.tjbt.hiscase.service.ExportFile"
autowire="byType">
<property name="directory" value="D:\数据交换平台导入目录\bl"></property>
<property name="charset" value="UTF-8"></property>
<property name="filename_generator_expression"
value="headers.get('patientId') == null ? headers.exportType + '-' + '.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId + '-' + '.xml'" />
</bean> <!-- <int-stream:stdout-channel-adapter
channel="logger" append-newline="true" />
-->
<int:wire-tap pattern="*" order="1" channel="logger" /> <int:channel id="logger">
<int:queue capacity="1000" />
</int:channel> <int:channel id="errorChannel">
<int:queue capacity="500" />
</int:channel> <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" >
<property name="brokerURL" value="tcp://localhost:61616"></property>
</bean> <bean id="destination"
class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg index="0" value="testmq"></constructor-arg>
</bean> <bean id="jmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"></property>
<property name="defaultDestination" ref="destination"></property>
<!--<property name="messageConverter" ref="innerMessageConverter"></property> -->
</bean> <bean id="MessageGateWay" class="com.tjbt.hiscase.mqUtil.MessageGateWay">
<property name="jsmt" ref="jmsTemplate" ></property>
</bean>
<bean id="messageListener" class="com.tjbt.hiscase.mqUtil.MessageMDB">
<property name="ms" ref="MessageService"></property>
</bean> <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer" lazy-init="false">
<property name="connectionFactory" ref="connectionFactory"></property>
<property name="destination" ref="destination"></property>
<property name="messageListener" ref="messageListener"></property>
<property name="concurrentConsumers" value="2"></property>
<!--0:CACHE_NONE,1:CACHE_CONNECTION,2:CACHE_SESSION,3:CACHE_CONSUMER,4:CACHE_AUTO-->
<property name="cacheLevel" value="0"/>
</bean> <bean id="MessageService" class="com.tjbt.hiscase.service.MessageService"></bean>
</beans>
<?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-event="http://www.springframework.org/schema/integration/event"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
xmlns:int-groovy="http://www.springframework.org/schema/integration/groovy"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:int-httpinvoker="http://www.springframework.org/schema/integration/httpinvoker"
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd
http://www.springframework.org/schema/integration/groovy http://www.springframework.org/schema/integration/groovy/spring-integration-groovy-2.0.xsd
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event-2.0.xsd
http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.0.xsd
http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.0.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/integration/httpinvoker http://www.springframework.org/schema/integration/httpinvoker/spring-integration-httpinvoker-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 获取目录下的的包中的所有类 -->
<context:component-scan base-package="com.tjbt.hiscase.tools" />
<int:gateway id="IGetPatientInfo" service-interface="com.tjbt.hiscase.service.IGetPatientInfo"
default-request-channel="channel1">
</int:gateway>
<int:gateway id="IGetClinicInfo" service-interface="com.tjbt.hiscase.service.IGetClinicInfo"
default-request-channel="Clinicchannel1">
</int:gateway> <int:poller id="globalPoller" default="true"
max-messages-per-poll="1" cron="0-59 * * * * ?" /> <int:inbound-channel-adapter ref="DataBaseService"
method="inbound" channel="channel1" auto-startup="${HisCaseIsExport}">
<int:poller cron="${HisCaseInterval}" />
<int:header name="exportType" value="患者住院信息" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter ref="ClinicService"
method="getInfo" channel="Clinicchannel1" auto-startup="${ClinicIsExport}">
<int:poller cron="${ClinicInterval}" />
<int:header name="exportType" value="门诊信息" />
</int:inbound-channel-adapter>
<!-- 全表导出配置 -->
<int:inbound-channel-adapter id="exprotCountry"
ref="DataBaseService" method="exprotCountry" channel="channel4"
auto-startup="${CountryTypeIsExport}">
<int:poller cron="${CountryTypeInterval}" />
<int:header name="exportType" value="国家字典" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotArea"
ref="DataBaseService" method="exprotArea" channel="channel4"
auto-startup="${AreaIsExport}">
<int:poller cron="${AreaInterval}" />
<int:header name="exportType" value="行政区字典" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotDept"
ref="DataBaseService" method="exprotDept" channel="channel4"
auto-startup="${DeptIsExport}">
<int:poller cron="${DeptInterval}" />
<int:header name="exportType" value="科室表" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotUsers"
ref="DataBaseService" method="exprotUsers" channel="channel4"
auto-startup="${UsersIsExport}">
<int:poller cron="${UsersInterval}" />
<int:header name="exportType" value="用户记录" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotDiagnosis"
ref="DataBaseService" method="exprotDiagnosis" channel="channel4"
auto-startup="${DiagnosisIsExport}">
<int:poller cron="${DiagnosisInterval}" />
<int:header name="exportType" value="诊断字典" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotStaff"
ref="DataBaseService" method="exprotStaff" channel="channel4"
auto-startup="${StaffIsExport}">
<int:poller cron="${StaffInterval}" />
<int:header name="exportType" value="员工信息" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotDrugName"
ref="DataBaseService" method="exprotDrugName" channel="channel4"
auto-startup="${DrugNameIsExport}">
<int:poller cron="${DrugNameInterval}" />
<int:header name="exportType" value="药品名称字典" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotLabReportItem"
ref="DataBaseService" method="exprotLabReportItem" channel="channel4"
auto-startup="${LabReportItemIsExport}">
<int:poller cron="${LabReportItemInterval}" />
<int:header name="exportType" value="项目报告字典" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exprotOrderClass"
ref="DataBaseService" method="exprotOrderClass" channel="channel4"
auto-startup="${OrderClassIsExport}">
<int:poller cron="${OrderClassInterval}" />
<int:header name="exportType" value="医嘱类别字典" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exportDeptVsWard"
ref="DataBaseService" method="exportDeptVsWard" channel="channel4"
auto-startup="${DeptWardIsExport}">
<int:poller cron="${DeptWardInterval}" />
<int:header name="exportType" value="临床科室与病房(区)对照" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exportDiagCorrDict"
ref="DataBaseService" method="exportDiagCorrDict" channel="channel4"
auto-startup="${DiagCorrDictIsExport}">
<int:poller cron="${DiagCorrDictInterval}" />
<int:header name="exportType" value="诊断是否符合参数表" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exportStaffVsGroup"
ref="DataBaseService" method="exportStaffVsGroup" channel="channel4"
auto-startup="${StaffVsGroupIsExport}">
<int:poller cron="${StaffVsGroupInterval}" />
<int:header name="exportType" value="员工分组情况" />
</int:inbound-channel-adapter> <int:inbound-channel-adapter id="exportPatsInHospital"
ref="DataBaseService" method="exportPatsInHospital" channel="channel4"
auto-startup="${PatsInHospitalIsExport}">
<int:poller cron="${PatsInHospitalInterval}" />
<int:header name="exportType" value="住院信息" />
</int:inbound-channel-adapter>
<!-- 建立一个channel 即连接数据库获取到的记录的channel -->
<int:channel id="channel1"> <!-- <int:interceptors> -->
<!-- <int:wire-tap channel="logger" /> -->
<!-- </int:interceptors> -->
</int:channel> <!-- 分割一个数组 分割成一条条的记录 -->
<int:splitter id="testSplitter" input-channel="channel1"
output-channel="channel2" /> <int:splitter id="testSplitter1" input-channel="Clinicchannel1"
output-channel="Clinicchannel2" /> <int:channel id="channel2">
<int:queue capacity="10" />
</int:channel>
<int:channel id="Clinicchannel2">
<int:queue capacity="10" />
</int:channel> <int:header-enricher input-channel="channel2"
output-channel="channel3">
<int:header name="exportType" value="患者住院信息" />
<int:header name="patientId" expression="payload.patientId" />
<int:header name="visitId" expression="payload.visitId" />
<int:header name="catalogDate" expression="payload.catalogDate" />
<int:header name="exportManner" value="auto"></int:header>
</int:header-enricher> <int:header-enricher input-channel="Clinicchannel2"
output-channel="Clinicchannel3">
<int:header name="exportType" expression="'门诊信息'+payload.visitDate+payload.visitNo" />
<int:header name="visitDate" expression="payload.visitDate" />
<int:header name="visitNo" expression="payload.visitNo" />
<int:header name="exportManner" value="auto"></int:header>
</int:header-enricher> <int:channel id="channel3">
<int:queue capacity="10" />
</int:channel> <int:channel id="Clinicchannel3">
<int:queue capacity="10" />
</int:channel> <!-- <int:chain input-channel="channel3" output-channel="channel3x"> -->
<!-- <int:header-enricher> -->
<!-- <int:header name="exportManner" value="auto" /> --> <!-- </int:header-enricher> -->
<!-- <int:filter ref="mapper" /> -->
<!-- </int:chain> --> <int:filter input-channel="channel3" output-channel="channel3x"
ref="mapper" /> <int:splitter input-channel="channel3x" output-channel="channel4"
ref="DataBaseService" method="dispatch" /> <int:splitter input-channel="Clinicchannel3"
output-channel="channel4" ref="ClinicService" method="dispatch" /> <int:channel id="channel4">
<int:queue capacity="1" />
</int:channel> <int:chain input-channel="channel4" output-channel="channel5"> <int:header-enricher>
<int:header name="exportSize" expression="payload.getSize()" /> </int:header-enricher>
<int:transformer ref="mapper" />
</int:chain> <int:publish-subscribe-channel id="channel5" /> <!-- 把转换好的xml输出到一个目录下 -->
<!--<int-file:outbound-channel-adapter
channel="channel5" id="filesOut" directory="D:\数据交换平台导出目录" charset="UTF-8"
filename-generator-expression="headers.get('patientId') == null ? headers.exportType + '-' + @mapper.getFileCreatedTime() +'.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId + '-' + @mapper.getFileCreatedTime() + '.xml'" />--> <!--<int-file:outbound-channel-adapter
channel="channel5" id="filesOut" directory="D:\" />--> <!-- 把转换好的xml输出到一个目录下 -->
<!-- <int-file:outbound-channel-adapter -->
<!-- channel="channel5" id="filesOutbackup" directory="D:\bbb" charset="UTF-8" -->
<!-- filename-generator-expression="headers.get('patientId') == null ? headers.exportType
+ '-' + '.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId
+ '-' + @mapper.getFileCreatedTime() + '.xml'" / -->
<int:bridge input-channel="channel5" output-channel="channel6">
</int:bridge>
<int:channel id="channel6">
<int:queue capacity="100" />
</int:channel>
<int:chain input-channel="channel6" output-channel="logger"> <int:service-activator ref="exportFile" method="saveFile">
<int:poller receive-timeout="5000" fixed-rate="100" />
</int:service-activator>
</int:chain> <int:chain input-channel="channel5">
<int:filter expression="headers.get('patientId') != null" />
<int:service-activator ref="AnalyseXMLService"
method="callJar">
<int:poller receive-timeout="5000" fixed-rate="200" />
</int:service-activator>
</int:chain> <int:channel id="channelBLGenerator">
<int:queue capacity="100" />
</int:channel>
<int:chain input-channel="channelBLGenerator" output-channel="logger">
<int:filter expression="headers.get('patientId') != null" />
<int:service-activator ref="blexportFile"
method="saveFile">
<int:poller receive-timeout="5000" fixed-rate="200" />
</int:service-activator>
</int:chain> <bean id="blexportFile" class="com.tjbt.hiscase.service.ExportFile"
autowire="byType">
<property name="directory" value="D:\数据交换平台导入目录\bl"></property>
<property name="charset" value="UTF-8"></property>
<property name="filename_generator_expression"
value="headers.get('patientId') == null ? headers.exportType + '-' + '.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId + '-' + '.xml'" />
</bean> <!--<int-stream:stdout-channel-adapter
channel="logger" append-newline="true" />--> <int:wire-tap pattern="*" order="1" channel="logger" /> <int:channel id="logger">
<int:queue capacity="1000" />
</int:channel> <int:channel id="errorChannel">
<int:queue capacity="500" />
</int:channel>
<bean id="exportLoggerInterceptor" class="com.tjbt.hiscase.tools.ExportLoggerInterceptor">
</bean>
<bean id="exportFile" class="com.tjbt.hiscase.service.ExportFile"
autowire="byType">
<property name="directory" value="D:\数据交换平台导入目录"></property>
<property name="charset" value="UTF-8"></property>
<property name="filename_generator_expression"
value="headers.get('patientId') == null ? headers.exportType + '-' + '.xml' : headers.exportType +'-' + headers.patientId + '-' + headers.visitId + '-' + '.xml'" />
</bean>
</beans>
<?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-event="http://www.springframework.org/schema/integration/event"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
xmlns:int-groovy="http://www.springframework.org/schema/integration/groovy"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:int-httpinvoker="http://www.springframework.org/schema/integration/httpinvoker"
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/integration/groovy http://www.springframework.org/schema/integration/groovy/spring-integration-groovy-2.0.xsd
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event-2.0.xsd
http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.0.xsd
http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd
http://www.springframework.org/schema/integration/feed http://www.springframework.org/schema/integration/feed/spring-integration-feed-2.0.xsd
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.0.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/integration/httpinvoker http://www.springframework.org/schema/integration/httpinvoker/spring-integration-httpinvoker-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.tjbt.hiscase.tools" /> <!-- poller 轮循病历 找到文件的目录 filename-pattern="*.xml" 找到.xml 没有的过滤掉-->
<int-file:inbound-channel-adapter id="blfilesIn"
directory="D:\数据交换平台导入目录\bl" prevent-duplicates="false" filename-pattern="*.xml">
<int:poller fixed-rate="1000" /> </int-file:inbound-channel-adapter> <int-file:file-to-string-transformer
input-channel="blfilesIn" delete-files="true" output-channel="blString"
charset="UTF-8" /> <int:channel id="blString">
<int:queue capacity="10" />
</int:channel> <int:service-activator ref="AnalyseXMLService"
method="analyseHiscase" input-channel="blString" output-channel="channel5">
<int:poller receive-timeout="5000" fixed-rate="1000" />
</int:service-activator>
<!-- <int:chain id="main-chain" input-channel="blfilesIn" output-channel="blString"> -->
<!-- <int:header-enricher> -->
<!-- <int:header name="filename" expression="payload.getName()" /> -->
<!-- </int:header-enricher> -->
<!-- <int-file:file-to-string-transformer delete-files="true" charset="UTF-8"
/> -->
<!-- </int:chain> --> <!-- <int:channel id="blString"> -->
<!-- <int:queue capacity="10" /> -->
<!-- </int:channel> --> <!-- <int:router input-channel="blString" -->
<!-- expression="headers.filename.substring(headers.filename.indexOf('_')+1).startsWith('病程记录')"> -->
<!-- <int:mapping value="true" channel="bcjlChannel" /> -->
<!-- <int:mapping value="false" channel="fbcjlChannel"/> -->
<!-- <int:poller fixed-rate="1000" /> -->
<!-- </int:router> --> <!-- <int:channel id="bcjlChannel"> -->
<!-- <int:queue capacity="10" /> -->
<!-- </int:channel> --> <!-- <int:channel id="fbcjlChannel"> -->
<!-- <int:queue capacity="10" /> -->
<!-- </int:channel> --> <!-- 病程类文件保存方法 -->
<!-- <int:service-activator ref="AnalyseXMLService" -->
<!-- method="analyseHisProcess" input-channel="bcjlChannel" output-channel="channel5"> -->
<!-- <int:poller receive-timeout="5000" fixed-rate="1000" /> -->
<!-- </int:service-activator> --> <!-- poller 轮循 找到文件的目录 -->
<int-file:inbound-channel-adapter id="filesIn"
directory="D:\数据交换平台导入目录" prevent-duplicates="false" filename-pattern="*.xml" >
<int:poller fixed-rate="1000" />
<!-- <int-file:nio-locker/> -->
</int-file:inbound-channel-adapter> <!-- 把文件转换成String -->
<int-file:file-to-string-transformer
input-channel="filesIn" output-channel="output" delete-files="true"
charset="UTF-8" /> <int:channel id="output">
<int:queue capacity="10" />
</int:channel> <int:transformer ref="mapper" input-channel="output"
output-channel="channel3">
<int:poller max-messages-per-poll="1" cron="0-59 * * * * ?" />
</int:transformer> <int:channel id="channel3">
<int:queue capacity="10" />
</int:channel> <int:service-activator ref="DataBaseService"
method="saveAll" input-channel="channel3" output-channel="channel5">
<int:poller receive-timeout="5000" fixed-rate="100" />
</int:service-activator> <int:channel id="channel5">
<int:queue capacity="1000" />
</int:channel> <int:chain input-channel="channel5" output-channel="logger">
<int:header-enricher>
<int:header name="importType" value="患者住院信息" />
</int:header-enricher>
</int:chain> <int:wire-tap pattern="*" order="3" channel="logger" /> <int:channel id="logger">
<int:queue capacity="1000" />
</int:channel> <!-- 准备一个线程池 -->
<task:executor id="taskExecutor" pool-size="50"
queue-capacity="20" /> <int:channel id="errorChannel">
<int:queue capacity="500" />
</int:channel>
<int:poller id="globalPoller" default="true"
max-messages-per-poll="1" cron="0-59 * * * * ?" />
</beans>
上述是我们做的一个数据交换平台,主要完成数据的抽取工作,分为人工和手工的数据抽取。
数据源:
文件系统
数据库
FTP数据源
JMS消息数据源
通过上述的了解,我们大致可以了解ETL,其实ETL仅仅是数据交换平台的一个过程
ESB的编程模型(场景)的更多相关文章
- BPM编程模型(场景)
一直开发基于操作的业务系统,主要就是通过界面,用户提交一些数据完成任务,大多数涉及多人协作的,基本都是浏览,少数可能对其进行审批,这里的审批不是电子政务那样的多人审批任务,仅仅是对数据的一个操作而已, ...
- ETL编程模型(场景)
使用场景: ETL是一个处理过程. 多个数据源之间进行数据同步 1:n:一对多同步数据 n:1:多个数据源到一个目的段 m;n:多个数据源多个目的段 ========================= ...
- 系统编程-网络-tcp客户端服务器编程模型(续)、连接断开、获取连接状态场景
相关博文: 系统编程-网络-tcp客户端服务器编程模型.socket.htons.inet_ntop等各API详解.使用telnet测试基本服务器功能 接着该上篇博文,咱们继续,首先,为了内容的完整性 ...
- Spring Batch批处理以及编程模型
1.批处理: 类似于SQL里面的批处理提交 2.场景: 业务定时进行批处理操作,但是批处理的编程模型是怎么的呢? 3.开源框架 Spring Batch 4.编程模型: reader-processo ...
- 云巴:基于MQTT协议的实时通信编程模型
概要 有人常问,云巴实时通信系统到底提供了一种怎样的服务,与其他提供推送或 IM 服务的厂商有何本质区别.其实,从技术角度分析,云巴与其它同类厂商都是面向开发者的通信服务,宏观的编程模型都是大同小异, ...
- 【温故知新】c#异步编程模型(APM)--使用委托进行异步编程
当我们用到C#类许多耗时的函数XXX时,总会存在同名的类似BeginXXX,EndXXX这样的函数. 例如Stream抽象类的Read函数就有 public abstract int Read(byt ...
- mapreduce编程模型你知道多少?
上次新霸哥给大家介绍了一些hadoop的相关知识,发现大家对hadoop有了一定的了解,但是还有很多的朋友对mapreduce很模糊,下面新霸哥将带你共同学习mapreduce编程模型. mapred ...
- Dubbo 新编程模型之外部化配置
外部化配置(External Configuration) 在Dubbo 注解驱动例子中,无论是服务提供方,还是服务消费方,均需要转配相关配置Bean: @Bean public Applicatio ...
- Spark:Spark 编程模型及快速入门
http://blog.csdn.net/pipisorry/article/details/52366356 Spark编程模型 SparkContext类和SparkConf类 代码中初始化 我们 ...
随机推荐
- OC基础知识总结 分类: ios学习 OC 2015-06-26 17:58 58人阅读 评论(0) 收藏
//OC: Objective-C, 面向对象的C语言 //OC与C的区别 //1.OC是C的超集, C语言的所有语法都可以在OC中使用 //2.OC是面向对象 //3.OC是一门运行时语言 //4. ...
- check camera and driver
1. How to check $ ls /dev/video* /dev/video0 /dev/video1 /dev/video2 /dev/video3 if not, U should ch ...
- 使用Nginx实现灰度发
灰度发布是指在黑与白之间,能够平滑过渡的一种发布方式.AB test就是一种灰度发布方式,让一部分用户继续用A,一部分用户开始用B,如果用户对B没有什么反对意见,那么逐步扩大范围,把所有用户都迁移到 ...
- CTF之LSB信息隐藏术
LSB也就是最低有效位,原理是图片中的像素一般是由三种颜色构成,即三原色(绿红蓝),由这三种颜色可以组成其它各种颜色. 例如在PNG图片的储存中,每个颜色会有8bit,LSB隐写就是修改了像素中的最低 ...
- 《DSP using MATLAB》Problem 4.21
快到龙抬头,居然下雪了,天空飘起了雪花,温度下降了近20°. 代码: %% -------------------------------------------------------------- ...
- LG4197 Peaks
题意 题目描述 在Bytemountains有N座山峰,每座山峰有他的高度hih_ihi.有些山峰之间有双向道路相连,共MMM条路径,每条路径有一个困难值,这个值越大表示越难走,现在有QQQ组询问, ...
- encode decode enumerate
format的用法 print(format('aa','>20')) print(format('aa','<20')) print(format('aa','^20')) 打印结果如下 ...
- drill 集成开源s3 存储minio
drill 支持s3数据的查询,同时新版的通过简单配置就可以实现minio 的集成 测试使用docker 运行drill 参考 https://www.cnblogs.com/rongfenglian ...
- DOS批处理 - 函数教程
DOS Batch - Function Tutorial What it is, why it`s important and how to write your own. Description: ...
- 声明变量(Declared Variable)和非声明变量(Undeclared Variable)的区别
声明变量的作用域限制在其声明位置的上下文中,而非声明变量总是全局的. 声明变量在任何代码执行前创建,而非声明变量只有在执行赋值操作的时候才会被创建. 声明变量是它所在上下文环境的不可配置属性(non- ...