mule的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,指定方式有两种:

  1. 在元素上追加传输协议前缀:
 <jetty:inbound-endpoint exchange-pattern="request-response"  doc:name="Jetty"/>

 <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<tcp:inbound-endpoint exchange-pattern="request-response" host="localhost" port="80" connector-ref="tcpConnector" responseTimeout="10000" doc:name="TCP"/>
  1. 通过元素的address属性指定:
<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以一致的地址发布,如:

<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路由的目的地,其往往是某个现存系统的访问入口。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值