配置一个Transport(Configuring a Transport)
Configuring a Transport
原文地址:http://www.mulesoft.org/documentation/display/MULE3USER/Configuring+a+Transport
你可以通过以下方式来进行Transport配置:
* 在你的Mule配置文件中配置使用<connector>配置connector
* 在endpoints设置transport属性,为单个endpoint实例定制transport行为
* 使用endpoint URI来为transport定义scheme 和 connection,如tcp://localhost:12345,更多信息参考Mule Endpoint URIs
该URI由传输协议的具体信息和connector中的0个或多个属性组成
该章节主要介绍针对所有的transport的通用属性,更详细的属性配置可以参考每个transport的配置文档,可以参考Available Transports.
通用的connector属性(Common Connector Properties)
所有的connector都要求你设置的属性名称都是在connector中唯一,它们都包含了以下这些通用属性:
| Property | Description | Default | Required |
|---|---|---|---|
| default-connector-exception-strategy | The exception strategy to use when errors occur in the connector. | No | |
| receiver-threading-profile |
The threading properties and WorkManager to use when receiving events from the connector. |
The default receiver threading profile set on the Mule Configuration |
Yes |
| dispatcher-threading-profile |
The threading properties and WorkManager to use when dispatching events from the connector. |
The default dispatcher threading profile set on the Mule Configuration. |
Yes |
| connection-strategy | Desupported as of Mule 2.0. Use retry policies instead. | No | |
| service-overrides |
A map of service configuration values that can be used to override the default configuration for this transport. |
No | |
| createMultipleTransactedReceivers |
Whether to create multiple concurrent receivers for this connector. This property is used by transports that support transactions, specifically receivers that extend the TransactedPollingMessageReceiver, and provides better throughput. |
false | No |
| numberOfConcurrentTransactedReceivers |
If createMultipleTransactedReceivers is set to true, the number of concurrent receivers that will be launched. |
No | |
| dynamicNotification | Whether to enable dynamic notification. | false | No |
| validateConnections |
Causes Mule to validate connections before use. Note that this is only a configuration hint; transport implementations may or may not make an extra effort to validate the connection. |
true | No |
你可以在你的connector中设置Spring属性,如果你想使用个性化connector的话这样将相当有用。
重试机制(Retry Policies)
重试机制配置了当一个connector连接失败时如何处理。更详细信息参考Configuring Reconnection Strategies.
创建你自己的Transport(Creating Your Own Transport)
为Mule ESB创建个性化transport的更多详细信息参考Creating Transports.
详细的配置信息(Detailed Configuration Information)
- Threading profiles
- Service overrides
接收线程概要(Receiver Threading Profile)
用于connector接收到信息时候的线程概要
<receiver-threading-profile...>属性
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| maxThreadsActive | integer | no | The maximum number of threads that will be used. | |
| maxThreadsIdle | integer | no |
The maximum number of idle or inactive threads that can be in the pool before they are destroyed. |
|
| threadTTL | integer | no | Determines how long an inactive thread is kept in the pool before being discarded. | |
| poolExhaustedAction |
WAIT/ DISCARD/ DISCARD_OLDEST/ ABORT/RUN |
no |
When the maximum pool size or queue size is bounded, this value determines how to handle incoming tasks. Possible values are: WAIT (wait until a thread becomes available; don't use this value if the minimum number of threads is zero, in which case a thread may never become available), DISCARD (throw away the current request and return), DISCARD_OLDEST (throw away the oldest request and return), ABORT (throw a RuntimeException), and RUN (the default; the thread making the execute request runs the task itself, which helps guard against lockup). |
|
| threadWaitTimeout | integer | no |
How long to wait in milliseconds when the pool exhausted action is WAIT. If the value is negative, it will wait indefinitely. |
|
| doThreading | boolean | no | true | Whether threading should be used (default is true). |
| maxBufferSize | integer | no |
Determines how many requests are queued when the pool is at maximum usage capacity and the pool exhausted action is WAIT. The buffer is used as an overflow. |
转发线程概要(Dispatcher Threading Profile)
用于connector转发信息时候的线程概要
<dispatcher-threading-profile...>属性值
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| maxThreadsActive | integer | no | The maximum number of threads that will be used. | |
| maxThreadsIdle | integer | no |
The maximum number of idle or inactive threads that can be in the pool before they are destroyed. |
|
| threadTTL | integer | no |
Determines how long an inactive thread is kept in the pool before being discarded. |
|
| poolExhaustedAction |
WAIT/ DISCARD/ DISCARD_OLDEST/ ABORT/ RUN |
no |
When the maximum pool size or queue size is bounded, this value determines how to handle incoming tasks. Possible values are: WAIT (wait until a thread becomes available; don't use this value if the minimum number of threads is zero, in which case a thread may never become available), DISCARD (throw away the current request and return), DISCARD_OLDEST (throw away the oldest request and return), ABORT (throw a RuntimeException), and RUN (the default; the thread making the execute request runs the task itself, which helps guard against lockup). |
|
| threadWaitTimeout | integer | no |
How long to wait in milliseconds when the pool exhausted action is WAIT. If the value is negative, it will wait indefinitely. |
|
| doThreading | boolean | no | true | Whether threading should be used (default is true). |
| maxBufferSize | integer | no |
Determines how many requests are queued when the pool is at maximum usage capacity and the pool exhausted action is WAIT. The buffer is used as an overflow. |
覆写服务(Service Overrides)
覆写服务允许你通过覆写transport的部分实现来进一步配置和定制,例如消息接收器或者消息转换器的实现,或者一个消息适配器的使用
<service-overrides...>属性
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| messageReceiver | string | no | ||
| transactedMessageReceiver | string | no | ||
| xaTransactedMessageReceiver | string | no | ||
| dispatcherFactory | string | no | ||
| inboundTransformer | string | no | ||
| outboundTransformer | string | no | ||
| responseTransformer | string | no | ||
| endpointBuilder | string | no | ||
| messageFactory | string | no | ||
| serviceFinder | string | no | ||
| sessionHandler | string | no | ||
| inboundExchangePatterns | string | no | ||
| outboundExchangePatterns | string | no | ||
| defaultExchangePattern | string | no |

浙公网安备 33010602011771号