为了节省时间,就不翻译了,摘抄重点总结下, 本文大部分摘抄自Mule ESB官网入门教程 Guide.pdf这本书中.
一 简介
Mule 3.0 provides three different constructs that can be used to build applications:
1.Using Mule Services are the classic Mule way of organizing message flow. Each service consists of three sections:
Input, where messages are received
An optional component, where any sort of application logic can be applied to a message
An optional output, where the messages are sent to other services or transports.
2.Using Flows for Service Orchestration, which are new in Mule 3.0. A flow is a combination of message sources and message processorsthat doesn't have as fixed a format as a service does. It can be as simple or as complex as required, and can include, for instance,processing by multiple components before any output is performed.
3.Using Mule Configuration Patterns are also new in Mule 3.0. A configuration pattern is like a pre-built flow: the logic is already built into it,so that only some simple tailoring is needed to make it functional.
A Mule application can contain any or all of these.
二 如何选择
选择 pattern的情形
Mule 3 includes a number of configuration patterns designed to solve common integration problems with minimal XML. These patterns are similar to Enterprise Integration Patterns which are also widely supported in Mule but tackle bigger use cases, like creating a web service proxy. Take amoment to inspect the list of patterns. If your project requires a more complex set of operations, you might want to consider flows which are
introduced in Mule 3.
选择service的情形
Mule's serviced-based architecture is well suited for many scenarios where you are using Mule as a service container and exposing services over
one or more endpoints. If you're familiar with using previous versions of Mule, you can continue - with very few changes - doing things the same
way.
选择flow的情形
A Flow is a simple yet very flexible mechanism that enables orchestration of services using the sophisticated message flow capabilities of Mule
ESB. Using Flow, you may automate integration processes and construct sophisticated integration solutions by simply building them from the
basic Building Blocks provided by Mule. Because of the flexibility of Flow, it is much easier to create solutions that more closely match your
requirements. Flow is new in Mule 3.
有些情况service比flow更好,比如这种情形
You still may choose to use Services in some cases. For example, if all you wish to do is expose a single service backed by a service component
and your requirements are more complex than with Simple Service supports, then a Mule Service is still a good choice. Existing Mule services
can also be easily integrated into a flow. Finally, flows do not yet support all features of Mule. In particular, services are still required if you want to
do any of the following:
Transactions configured anywhere other than on endpoints e.g. on routers (including local, multi-tx, and XA)
Request-Reply