Mule ESB的component(一)——概念介绍

1. Component(组件)的定义:

Components are at the core of Mule services: each service hosts a component. This components is the destination for messages after they have been received by the inbound endpoint, unless filtering or forwarding router is used.

Component(组件)是mule的核心:每一个services都拥有一个component。这个component是inbound endpoint接收到message(消息)后的目的地,除非被过滤或路由被使用。

2. 什么场合适合使用component(组件)

. Some message-related operations are not conceptually fitted anywhere else. For example, a transformer would not be the best place for executing business logic or logging messages.

一些关于消息的操作从概念上讲不适合放在其他任何地方。比如,一个transformer并非执行业务逻辑或记录消息日志的最好的地方。

. Processing a message might require to communicate with another service. Components can act as one-stop communication devices and perform operations like synchronous RPC calls in a more straightforward manner than what you could do with, say, a chaining router and a bunch of transformers.

当消息处理需要与其他业务交流。在一次简单的RPC远程调用中,你可以使用component(组件)作为一站式解决方案或是执行方法,就像一个router(路由)和一个transformers(转换器).

. Unlike other Mule moving parts, components do not mandate the imp lementation of a specific interface. This enables the usage of any existing business logic POJO directly as a Mule component.

不像其他mule的组件,component(组件)不需要继承任何特殊的接口。这用使得mule的component可以直接执行任何已知的业务逻辑。

. Components offer features that other Mule entities do not. For example, you can pool components to handle heavy concurrent workloads only by means of configuration.

component(组件)提供了mule其他模块所不具备的功能。比如你可以使用pool components(组件池)的配置操作一个重量级的并发负载。

. Exceptions thrown at component level do not have the same semantics than exception thrown elsewhere. If your custom code executes business logic, throwing an exception from a transformer or a router would not be interpreted and reported the same way by Mule than if you were throwing it from your component.The former would be handled by the connector’s exception strategy, while the latter would be handled by the service exception strategy.

component层抛出的异常和其他地方抛出的异常含义不同。在你自定义的业务逻辑中,tansformer或router使用mule抛出的异常和component抛出的异常在解析和返回的方式不同。因为前者将交由connecter的异常策略,而后者则交由service异常策略。


猜你喜欢

转载自winnie825.iteye.com/blog/1724833