mule esb
什么是Mule ESB? (What is Mule ESB?)
Mule, the runtime platform and a nimble Java-based enterprise service (ESB) which allows developers to easily build high-performance, secure, multi-protocol interactions between heterogeneous systems and services. It enables easy integration of existing systems, regardless of the different technologies that the applications use. The exchange of data between applications is carried by different messaging format.
Mule,运行时平台和灵活的基于Java的企业服务(ESB),使开发人员可以轻松地在异构系统和服务之间建立高性能,安全,多协议的交互。 无论应用程序使用何种技术,它都可以轻松集成现有系统。 应用程序之间的数据交换由不同的消息传递格式进行。
Following are the powerful capabilities of Mule ESB:
以下是Mule ESB的强大功能:
- Data Transformation 数据转换
- Service Mediation 服务调解
- Service creation and hosting 服务创建和托管
- Message Routing 邮件路由
Mule ESB的优势 (Advantages of Mule ESB)
- Lightweight but scalable, permitting you to start small and connect more applications in future. 轻巧但可扩展,可让您从小处着手,并在将来连接更多应用程序。
- Well suited to the scenarios where loose coupling, robustness, and scalability required. 非常适合需要松散耦合,鲁棒性和可伸缩性的方案。
- It has support for more than 30 protocols and technologies. 它支持30多种协议和技术。
- Mule platform encourages component reuse profusely; no need to run or add Mule specific code in any of the component. Also, the business logic is separated from messaging logic. Mule平台鼓励大量重复使用组件; 无需在任何组件中运行或添加Mule特定代码。 而且,业务逻辑与消息传递逻辑是分开的。
- Mule does not force any design constraints while choosing messaging format. It varies from SOAP to Binary image files. 选择消息格式时,Mule不会强加任何设计约束。 从SOAP到Binary图像文件,它都不同。
Mule ESB架构 (Mule ESB Architecture)
Mule ESB Architecture
Mule ESB架构
ule子消息结构 (Mule Message Structure)
It is the data format which is internally used by Mule to communicate between different applications via one or more flows.
它是Mule内部用于通过一个或多个流在不同应用程序之间进行通信的数据格式。
Mule Message Structure
ule子消息结构
Primarily it consists of two main parts:
它主要包括两个主要部分:
- Header — which is nothing but the metadata of message. 标头-只是消息的元数据。
- Payload — which is the actual business message. 有效负载-这是实际的业务信息。
Message Object is used to envelop the Mule Message along with some extra attributes like Attachment, Variable, and Exception Payload — which may not appear in every case.
消息对象用于包裹Mule消息以及一些附加属性,例如附件,变量和异常有效负载-可能不会在每种情况下都出现。
The metadata is represented by properties— which provides useful information in order to facilitate processing and avoid errors when the message enters new flow or being transmitted to another application. Properties and Variables, contained within Mule Object, keep data in key-value format.
元数据由属性表示,这些属性提供有用的信息,以便在消息进入新流或传输到另一个应用程序时促进处理并避免错误。 包含在Mule对象中的属性和变量将数据保留为键值格式。
Properties have two main scopes:
属性有两个主要范围:
- Inbound Properties:
- These are immutable, automatically generated by the message source.
- They deter scrambling of data formats and any other manipulation in message lifecycle.
- Inbound properties’ scope is limited to only a flow; once message whisks to another flow, its inbound properties are disappeared.
- Mule Expression Language (MEL) Example:
#[message.outboundProperties]
- 这些是不可变的,由消息源自动生成。
- 它们阻止了数据格式的混乱以及消息生命周期中的任何其他操作。
- 入站属性的范围仅限于流; 一旦消息跳到另一个流,它的入站属性就会消失。
- ule子表达语言(MEL)示例:
#[message.outboundProperties]
- Outbound Properties:
- These are mutable and can be set by Mule or a user can alter them by using transformer elements in the flow.
- They can become inbound properties when message passed outbound endpoint of one flow to inbound endpoint of another flow.
- In one case—if message is passed to any flow-ref, then the outbound properties remain same as outbound properties.
- MEL Example:
#[message.inboundProperties]
- 这些是可变的,可以由Mule设置,或者用户可以通过在流中使用变形器元素来更改它们。
- 当消息将一个流的出站端点传递到另一流的入站端点时,它们可以成为入站属性。
- 在一种情况下,如果将消息传递到任何流引用,则出站属性与出站属性保持相同。
- MEL示例:
#[message.inboundProperties]
Variables have three scopes:
变量具有三个作用域:
- Flow Variables— can be accessed within the same flow. 流变量-可以在同一流中访问。
- Session Variables— apply across the flows within the same application. 会话变量-适用于同一应用程序中的流。
- Record Variables— apply to only to records processed under batch 记录变量—仅适用于按批处理的记录
Message Payload contains the data your Mule application processes. Payload changes during its journey through different flow. It is set, enriched, or transformed into the new format by various of a Message processor in a Mule flow.
消息有效负载包含您的Mule应用程序处理的数据。 有效载荷在通过不同流程的过程中会发生变化。 它由Mule流中的各种Message处理器设置,丰富或转换为新格式。
MEL Example to extract payload information: #[payload]
MEL提取有效载荷信息的示例: #[payload]
ule子运行时设置 (Mule Runtime Setup)
- Mule Runtime Community (CE) or Enterprise (EE) edition is available here:
- For installing Anypoint Studio, the IDE for creating integration applications, click here:
Anypoint Studio Hello World项目 (Anypoint Studio Hello World Project)
Let’s construct an application step by step which returns “Hello Mule” message to the browser when you hit the service.
让我们逐步构建一个应用程序,当您点击该服务时,该应用程序会向浏览器返回“ Hello Mule”消息。
- Launch the Anypoint Studio platform by navigating to a directory on your local machine where you installed. 通过导航到本地计算机上安装的目录来启动Anypoint Studio平台。
- Create new Mule project, either by hitting “Create Project” link appeared on the Welcome screen or by navigating to File > New > Mule Project. 通过单击“欢迎”屏幕上出现的“创建项目”链接或导航至“ 文件”>“新建”>“ Mule项目 ”,创建新的Mule项目 。
- Enter the name of your project in “Project Name” section. 在“项目名称”部分输入您的项目名称。
Anypoint Studio Create New Project
Anypoint Studio创建新项目
- Click on Finish, and you will see Studio Canvas screen as following: 单击完成,您将看到Studio Canvas屏幕,如下所示:
Anypoint Studio Hello World Project Structure
Anypoint Studio Hello World项目结构
- At the bottom of canvas there are three tabs—Message Flow, Configuration XML and Global Elements. Message Flow and Configuration XML are the two tabs to show or edit Mule flow in visual and xml format, respectively. Global Elements tab exudes properties for configuration elements having scope global. 在画布的底部,有三个选项卡-消息流,配置XML和全局元素。 消息流和配置XML是分别以可视和XML格式显示或编辑Mule流的两个选项卡。 “全局元素”选项卡散布具有全局范围的配置元素的属性。
- Select a HTTP connector from Mule Palette and drag it into canvas. 从Mule Palette中选择一个HTTP连接器并将其拖到画布中。
Anypoint Studio Hello Mule HTTP Connector
Anypoint Studio Hello Mule HTTP连接器
- Go to the HTTP Listener configuration panel – clicking on green plus symbol under General settings in HTTP Connector – and enter Host and Port values. 转到HTTP侦听器配置面板-单击HTTP连接器中“常规设置”下的绿色加号-并输入主机和端口值。
Mule ESB HTTP Connector Settings
Mule ESB HTTP连接器设置
Mule ESB HTTP Listener Configurations
Mule ESB HTTP侦听器配置
- Search for the Set Payload and drag the transformer to the flow. 搜索“设置有效载荷”,然后将变压器拖动到流中。
Mule Message Set Payload
ule子消息集有效载荷
- Click on Set Payload transformer and set the Value field as “Hello Mule”. 单击“设置有效负载转换器”,并将“值”字段设置为“ Hello Mule”。
Mule Message Payload Value
ule子消息有效载荷值
- Drag the Logger and set the payload value received from Set Payload transformer into Message. 拖动记录器,并将从“设置有效载荷”转换器接收到的有效载荷值设置为“消息”。
Anypoint Studio Logger
Anypoint Studio记录器
- After connecting all the Mule components, you flow, in XML format, looks like this:
连接所有Mule组件后,您将以XML格式进行如下所示的流程:<flow name="hellomuleexampleFlow"> <https:listener config-ref="HTTP_Listener_Configuration" path="/message" doc:name="HTTP"/> <set-payload value="Hello Mule" doc:name="Set Payload"/> <logger message="#[payload]" level="INFO" doc:name="Logger"/> </flow> - To test your application — run it as Mule Application. You can see console logs as below to verify the application is deployed and started successfully. 要测试您的应用程序—将其作为Mule Application运行。 您可以看到以下控制台日志,以验证应用程序已部署并成功启动。
Anypoint Studio Run As Mule Application
Anypoint Studio运行为M子应用程序
- Fire up the browser and hit the address
https://localhost:8081/message. You can see response as “Hello Mule”. 启动浏览器,并点击地址https://localhost:8081/message。 您可以看到响应为“ Hello Mule”。
Mule Hello World Web Application
Mule Hello World Web应用程序
mule esb
Mule ESB是一个轻量级但可扩展的Java ESB,用于构建高性能、安全的多协议交互。它提供数据转换、服务调解等功能,支持30多种协议。Mule ESB的优势在于其可扩展性、松散耦合和可伸缩性,适用于需要集成异构系统的场景。Mule ESB的消息结构包括元数据和业务信息两部分,而Mule运行时环境包括社区版和企业版。
1117

被折叠的 条评论
为什么被折叠?



