天天看點

MULE ESB中custom,flows,connectors等的使用方法

1. how to work

    當你去檢查一個消息在mule esb當中 是如何流動的時候,你回發現整個架構中存在着三個層面:應用層,整合層,以及傳輸層..

    同樣,在mule 開發中也有三種不同類型任務你需要去做:

           (1)  服務元件開發 可以是存在的pojo,cloud connectors ,或者是包含業務邏輯的和消費,處理消息的sping bean

           (2)  服務協調,通過配置各種 服務調停和協調必須得元件 去允許松耦合的元件去使用mule 流.

           (3)  服務整合 屏蔽協定讓每個服務之間實作解耦合.

2. about mule configuration

    一個mule esb 配置檔案就是一棵樹,就像下圖展示的一樣(圖:)

    圖中的每個元件都提供了通路mule内部配置對象的能力:

    custom message processors 處理消息,修改消息或消息流.

    flows 使用message processors 去定義源頭和目标之間的消息流 

    mule global configuration 全局配置,比如預設交易逾時時間

    connectors 任何一中傳輸方式使用的非預設配置

    endpoints  定義接收和發送消息所使用的通道,位址,或者是路徑,你可以在全局環境中配置它們,在多個flow中引用

    transformers 将資料從一種格式轉換成另一種格式,你可以在全局環境中定義它們,在多個flow中引用.

    filters 過濾中不符合已定義規則的消息,,你可以在全局環境中定義它們,在多個flow中引用.

    models 一個或多個models将你得服務元件有邏輯性的組織起來

    services 一個或多一個service 封裝了你的components,configure routers,endpoints,transformers,and filters.

   下面是一個簡單的mule esb 配置檔案樣本.

<mule

xmlns="http://www.mulesoft.org/schema/mule/core" 

      xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" 

      xmlns:vm="http://www.mulesoft.org/schema/mule/vm" 

      xsi:schemalocation=" 

          http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd 

          http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.0/mule-vm.xsd"> 

    <vm:connector

name="vmconnector"

queuetimeout="5000"/> 

    <vm:endpoint

name="customerrequests"

path="customer.requests"/> 

name="customerresponses"

path="customer.responses"/> 

    <custom-transformer

name="thistothat"

class="com.acme.transformer.thistothat"/> 

    <flow

name="mybasicflow"> 

        <inbound-endpoint

ref="customerrequests"/> 

        <component

class="com.acme.service.basicservice"/> 

        <outbound-endpoint

ref="customerresponses"

transformer-refs="thistothat"/> 

    </flow> 

</mule> 

3. understanding the mule architeture(了解mule的架構)

   about soa 面向服務架構,詳情具體google.

   mediation 從消息中分離業務邏輯

   orchestration 在不同的服務元件中路由消息

   components 處理消息資料

   endpoints 把everyging 裝配到一個

   了解邏輯資料流