此内容没有您所选择的语言版本。
Chapter 16. Conduits
Abstract
Conduits are a low-level piece of the transport architecture that are used to implement outbound connections. Their behavior and life-cycle can effect system performance and processing load.
Overview
Conduits manage the client-side, or outbound, transport details in the Apache CXF runtime. They are responsible for opening ports, establishing outbound connections, sending messages, and listening for any responses between an application and a single external endpoint. If an application connects to multiple endpoints, it will have one conduit instance for each endpoint.
Each transport type implements its own conduit using the Conduit interface. This allows for a standardized interface between the application level functionality and the transports.
In general, you only need to worry about the conduits being used by your application when configuring the client-side transport details. The underlying semantics of how the runtime handles conduits is, generally, not something a developer needs to worry about.
However, there are cases when an understanding of conduit’s can prove helpful:
- Implementing a custom transport
- Advanced application tuning to manage limited resources
Conduit life-cycle
Conduits are managed by the client implementation object. Once created, a conduit lives for the duration of the client implementation object. The conduit’s life-cycle is:
-
When the client implementation object is created, it is given a reference to a
ConduitSelector
object. When the client needs to send a message is request’s a reference to a conduit from the conduit selector.
If the message is for a new endpoint, the conduit selector creates a new conduit and passes it to the client implementation. Otherwise, it passes the client a reference to the conduit for the target endpoint.
- The conduit sends messages when needed.
- When the client implementation object is destroyed, all of the conduits associated with it are destroyed.
Conduit weight
The weight of a conduit object depends on the transport implementation. HTTP conduits are extremely light weight. JMS conduits are heavy because they are associated with the JMS Session
object and one or more JMSListenerContainer
objects.