日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Mule的基本配置元素:Endpoint、Transformer、Filter、Flow

發布時間:2024/9/27 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Mule的基本配置元素:Endpoint、Transformer、Filter、Flow 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.Endpoint


Mule的endpoint和WS中的endpoint是非常類似的,它是消息進出(讀寫)的入口,不同的是mule的endpoint可以基于各種不同的傳輸協議。
mule的endpoint分成兩類:
  • ??? global endpoint:全局的endpoint,一個flow或service的inbound或outbound endpoint可以通過ref屬性引用這些endpoint.
  • ???? low或service內的inbound或outbound endpoint,這類endpoint僅限于flow或service內,可以認為是一種局部endpoint.
每一個endpoint都必須指明它的傳輸協議是什么,或者說它是什么傳輸類型的endpoint,指定方式有兩種:
  • ???? 在<endpoint/>元素上追加傳輸協議前綴:
[html]view plaincopy
  • <http:endpoint?name="in"?host="localhost"?port="8080"?path?=?"services/orders"?user="${user.name}"?password?="${user.password}"/>??

    • ??? 通過<endpoint/>元素的address屬性指定:
    [html]view plaincopy
  • <endpoint?addres="http://${user.name}:${user.password}@localhost:8080/services/orders/>??

  • 剛開始接觸mule時對inbound和outbound的endpoint可能一時不太好區分,實際上所謂的in和out都是以mule的視角來定位的,inbound指的是外部message“流入”mule的斷點,也就是mule暴露給外部應用可以訪問的端點,同理,outbound就是message從mule向外“流出”的端點,也就是一個可以訪問的外部應用的端點。比如一種最典型也是最普遍的WS代理配置,也就是將不同物理地址的WS統一掛接到ESB,由ESB以一致的地址發布,如:

    [html]view plaincopy
  • <pattern:web-service-proxy?name="weather-forecast-ws-proxy"??
  • ????inboundAddress="http://localhost:8090/weather-forecast"??
  • ????outboundAddress="http://server1:6090/weather-forecast"??
  • ????wsdlLocation="http://server1:6090/weather-forecast?wsdl"?/>??

  • 在這段配置中,ESB把原物理地址為:http://server1:6090/weather-forecast 的服務經過包裹,以新的地址http://localhost:8090/weather-forecast 發布出去。作為inboundAddress,http://localhost:8090/weather-forecast是ESB對外“開放”或“發布”的端點,也就是消息流入ESB的端點。outboundAddress則是ESB路由的目的地,其往往是某個現存系統的訪問入口。


    2.Transformer


    Transformer是負責消息傳輸過程中的數據轉換,如從JSON對象到一個Java對象的轉換:

    [html]view plaincopy
  • <json:json-to-object-transformer?name="jsonToFruitCollection"?returnClass="org.mule.module.json.transformers.FruitCollection">??
  • <json:deserialization-mixin?mixinClass="org.mule.module.json.transformers.OrangeMixin"?targetClass="org.mule.tck.testmodels.fruit.Orange"/>??
  • </json:json-to-object-transformer>??

  • 3.Filter


    Filter是用于配置是否要對消息進行過濾的配置項,除像wildcard-filter這樣的基本Filter,Mule還有功能強大的邏輯Filter用于進行過濾條件的組合。

    [java]view plaincopy
  • <or-filter>??
  • ????<wildcard-filter?pattern="*priority:1*"/>??
  • ????<and-filter>??
  • ????????<not-filter>??
  • ????????????<wildcard-filter?pattern="*region:Canada*"/>??
  • ????????</not-filter>??
  • ????????<wildcard-filter?pattern="*priority:2*"/>??
  • ????</and-filter>??
  • </or-filter>??

  • 4.Flow


    Flow是mule的最基本處理單元。它從一個inbound endpoint開始,對message進行了一系列的處理,然后從outbound endpoint輸出。這期間會flow會使用到上述提及的多種組件參與處理,如transformer、filter等等,而且還可能調用java或其他語言實現的組件進行處理,應該說在應用集成里,flow所要實現的,正是所謂的“集成邏輯”。

    總結

    以上是生活随笔為你收集整理的Mule的基本配置元素:Endpoint、Transformer、Filter、Flow的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。