看看一个配置文件,了解ESB的编程模型

<?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的编程模型

时间: 2024-11-09 23:56:56

看看一个配置文件,了解ESB的编程模型的相关文章

常见的多线程编程模型

1.基本概念:sleep,join,yied,优先级. 2.进程,线程:独立的内存空间,内存地址,不会相互影响. 3.数据结构:(共享资源的软件模拟)-队列, 4.并发控制:信号量机制(硬件机制原理),软件实现(锁机制-比如读写分离,基于二维的锁兼容性) 5.障碍器,信号量,锁 6.CPU密集型--计算,I/O密集型--传输(网络或者文件)--TCP或者串口等--阻塞和非阻塞(读取-写入-更新--这就是一个原子操作或者微命令) 编程模型: 1.while(true) {new Thread()}

浅谈云巴实时通信的编程模型

浅谈云巴实时通信的编程模型 中国物联网 2016-09-28 09:38 概要 有人常问,云巴实时通信系统到底提供了一种怎样的服务,与其他提供推送或 IM 服务的厂商有何本质区别.其实,从技术角度分析,云巴与其它同类厂商都是面向开发者的通信服务,宏观的编程模型都是大同小异,真正差异则聚焦于产品定位,业务模式,基础技术水平等诸多细节上.本文暂不讨论具体产品形态上的差异,着重从技术角度浅谈实时通信的编程模型. 什么是实时通信 「实时」(realtime) 一词在语义层面上隐含着对时间的约束(real

Storm介绍及核心组件和编程模型

离线计算 离线计算:批量获取数据.批量传输数据.周期性批量计算数据.数据展示 代表技术:Sqoop批量导入数据.HDFS批量存储数据.MapReduce批量计算数据.Hive批量计算数据.azkaban/oozie任务调度 流式计算 流式计算:数据实时产生.数据实时传输.数据实时计算.实时展示 代表技术:Flume实时获取数据.Kafka/metaq实时数据存储.Storm/JStorm实时数据计算.Redis实时结果缓存.持久化存储(mysql). 一句话总结:将源源不断产生的数据实时收集并实

理解ASP.NET中MVC 编程模型 上

MVC 编程模型 MVC 是 ASP.NET 开发模型之一. MVC 是用于构建 web 应用程序的一种框架,使用 MVC (Model View Controller) 设计: Model(模型)表示应用程序核心(比如数据库记录列表) View(视图)对数据(数据库记录)进行显示 Controller(控制器)处理输入(写入数据库记录) MVC 模型同时提供对 HTML.CSS 以及 JavaScript 的完整控制. MVC 模型通过三个逻辑层来定义 web 应用程序: business l

MapReduce编程模型及其在Hadoop上的实现

转自:https://www.zybuluo.com/frank-shaw/note/206604 MapReduce基本过程 关于MapReduce中数据流的传输过程,下图是一个经典演示:  关于上图,可以做出以下逐步分析: 输入数据(待处理)首先会被切割分片,每一个分片都会复制多份到HDFS中.上图默认的是分片已经存在于HDFS中. Hadoop会在存储有输入数据分片(HDFS中的数据)的节点上运行map任务,可以获得最佳性能(数据TaskTracker优化,节省带宽). 在运行完map任务

Storm 第一章 核心组件及编程模型

1 流式计算 流式计算:数据实时产生.实时传输.实时计算.实时展示 代表技术:Flume实时获取数据.Kafka/metaq实时数据存储.Storm/JStorm实时数据计算.Redis实时结果缓存.持久化存储(mysql). 一句话总结:将源源不断产生的数据实时收集并实时计算,尽可能快的得到计算结果. 2 Storm是什么 Storm 是用来实时处理数据,特点:低延迟.高可用.分布式.可扩展.数据不丢失,提供简单容易理解的接口,便于开发. 3 Storm 与Hadoop的区别 Storm用于实

MapReduce分布式编程模型

hdfs的副本的配置修改hdfs-site.xml文件<property><name>dfs.namenode.secondary.http-address</name><value>hd-02:50090</value></property>需要同步到其它机器:scp hdfs-site.xml hd-02:$PWDhadoop启动方式1)启动hdfs集群$ start-dfs.sh2)启动yarn集群$ start-yarn.sh

Linux的I/O模式、事件驱动编程模型

大纲: (1)基础概念回顾 (2)Linux的I/O模式 (3)事件驱动编程模型 (4)select/poll/epoll的区别和Python示例 网络编程里常听到阻塞IO.非阻塞IO.同步IO.异步IO等概念,总听别人装13不如自己下来钻研一下.不过,搞清楚这些概念之前,还得先回顾一些基础的概念. 1.基础知识回顾 注意:咱们下面说的都是Linux环境下,跟Windows不一样哈~~~ 1.1 用户空间和内核空间 现在操作系统都采用虚拟寻址,处理器先产生一个虚拟地址,通过地址翻译成物理地址(内

ARMV8 datasheet学习笔记4:AArch64系统级体系结构之编程模型(4)- 其它

1. 前言 2.可配置的指令使能/禁用控制和trap控制 指令使能/禁用 当指令被禁用,则这条指令就会变成未定义 指令Trap控制 控制某条或某些指令在运行时进入陷阱,进入陷阱的指令会产生trap异常,路由规则如下: (1)当前为EL1,则陷阱异常传递给EL1(HCR_EL2.TGE定义为1时,会路由到EL2); (2)当前为EL2,则陷阱异常传递给EL2; (3)当前为EL3,则陷阱异常传递给EL3; 3. 系统调用 SVC 默认情况下SVC产生supervisor call,同步异常目标级别