Mule简介

404 阅读1分钟

Mule概览

Mule组件:

Core Components、Connectors、Modules

流程和子流程:

流程一般有一个Mule源,例如HTTP listener。

子流程像一个宏命令,让流程使用子流程引用代替内容。

Mule配置文件

Mule事件:

概览:

 
Mule消息包含payload和attributes
消息来源可能是定时任务、Http监听器、文件组件
每生成一个事件都会创建一个唯一ID
Variables:例如命名为myVar,获取它:vars.myVar
Payload:例如:{"hello":"world"},获取它:payload.'hello'
attributes:例如:{id:"1234","123 abc":"aaa","Status Code":200},获取它,attributes.id,attributes.'123 abc',attributes.statusCode
具体查看文档:
https://docs.mulesoft.com/http-connector/1.6/http-connector-xml-reference#http-request

Mule异常:

错误类型总体分为ANY和CRITICAL,不明确的可以使用UNKNOW。

类型命名一般是命名空间:错误类型,也可以自定义错误映射。

XML Configuration for Mappings:

<flow name="retrieveMatchingOrders">
  <http:request config-ref="customersConfig" path="/customer">
    <error-mapping sourceType="CONNECTIVITY" targetType="APP:CUSTOMER_API"/>
  </http:request>
  <http:request config-ref="ordersConfig" path="/order">
    <error-mapping sourceType="CONNECTIVITY" targetType="APP:ORDER_API"/>
  </http:request>
  <error-handler>
    <on-error-continue type="APP:CUSTOMER_API">
      <logger message="#['Could not retrieve customer data.']"/>
    </on-error-continue>
    <on-error-continue type="APP:ORDER_API">
      <logger message="#['Could not retrieve customer order data.']"/>
    </on-error-continue>
  </error-handler>
</flow>

高级Mule概念:

执行引擎:

响应式引擎

类加载隔离机制:
分布式文件拉取:
分布式锁:
Mule Java文档:
第三方库: