An abstract implementation of {@link Connector} that provides a {@link ConnectionFactory} mechanismfor creating {@link Connection} instances for various protocols (HTTP, SSL, SPDY, etc).
The protocol factory used for newly accepted connections is specified by the method {@link #setDefaultProtocol(String)} or defaults to the protocol of the first configured factory.
Each Connection factory type is responsible for the configuration of the protocols that it accepts. Thus to configure the HTTP protocol, you pass a {@link HttpConfiguration} instance to the {@link HttpConnectionFactory}(or the SPDY factories that can also provide HTTP Semantics). Similarly the {@link SslConnectionFactory} isconfigured by passing it a {@link SslContextFactory} and a next protocol name.
{@link ConnectionFactory}s may also create a chain of {@link Connection} instances, using other {@link ConnectionFactory} instances.For example, the {@link SslConnectionFactory} is configured with a next protocol name, so that once it has accepteda connection and created an {@link SslConnection}, it then used the next {@link ConnectionFactory} from theconnector using the {@link #getConnectionFactory(String)} method, to create a {@link Connection} instance thatwill handle the unecrypted bytes from the {@link SslConnection}. If the next protocol is "http/1.1", then the {@link SslConnectionFactory} will have a protocol name of "SSL-http/1.1" and lookup "http/1.1" for the protocolto run over the SSL connection.
{@link ConnectionFactory}s may also create temporary {@link Connection} instances that will exchange bytesover the connection to determine what is the next protocol to use. For example the NPN protocol is an extension of SSL to allow a protocol to be specified during the SSL handshake. NPN is used by the SPDY protocol to negotiate the version of SPDY or HTTP that the client and server will speak. Thus to accept a SPDY connection, the connector will be configured with {@link ConnectionFactory}s for "SSL-NPN", "NPN", "spdy/3", "spdy/2", "http/1.1" with the default protocol being "SSL-NPN". Thus a newly accepted connection uses "SSL-NPN", which specifies a SSLConnectionFactory with "NPN" as the next protocol. Thus an SslConnection instance is created chained to an NPNConnection instance. The NPN connection then negotiates with the client to determined the next protocol, which could be "spdy/3", "spdy/2" or the default of "http/1.1". Once the next protocol is determined, the NPN connection calls {@link #getConnectionFactory(String)} to create a connection instance that will replace the NPN connection asthe connection chained to the SSLConnection.
AbstractConnector
provides base functionality for all connectors provided with Mule. Connectors are the mechanism used to connect to external systems and protocols in order to send and receive data. The AbstractConnector
provides getter and setter methods for endpoint name, transport name and protocol. It also provides methods to stop and start connectors and sets up a dispatcher threadpool which allows deriving connectors the possibility to dispatch work to separate threads. This functionality is controlled with the doThreading property on the threadingProfiles for dispatchers and receivers. The lifecycle for a connector is -
|
|