Changing the Default Transport
APIs are synapse configurations in the back-end and API Manager accesses them using HTTP-NIO transport by default. You can switch to a different transport such as PassThrough. To change the default transport of API Manager, go to <APIM_HOME>/repository/conf/axis2
folder and rename axis2.xml_PT
file to axis2.xml
. Similarly, you can switch back to NHTTP by simply renaming axis2.xml_NHTTP
file to axis2.xml
.
The following topics explain HTTP-NIO and PassThrough transports:
HTTP-NIO transport
HTTP-NIO transport is a module of the Apache Synapse project. Apache Synapse as well as WSO2 APIM ship the HTTP-NIO transport as the default HTTP transport implementation. The two classes that implement the receiver and sender APIs are org.apache.synapse.transport.nhttp.HttpCoreNIOListener
and org.apache.synapse.transport.nhttp.HttpCoreNIOSender
respectively. These classes are available in the JAR file named synapse-nhttp-transport.jar
. This non-blocking transport implementation improves performance. The transport implementation is based on Apache HTTP Core - NIO and uses a configurable pool of non-blocking worker threads to grab incoming HTTP messages off the wire.
Transport receiver parameters
In transport parameter tables, literals displayed in italic mode under the "Possible Values" column should be considered as fixed literal constant values. Those values can be directly put in transport configurations.
Parameter Name | Description | Requried | Possible Values | Default Value |
---|---|---|---|---|
port | The port on which this transport receiver should listen for incoming messages. | No | A positive integer less than 65535 | 8280 |
non-blocking | Setting this parameter to true is vital for reliable messaging and a number of other scenarios to work properly. | Yes | true | Â |
bind-address | The address of the interface to which the transport listener should bind. | No | A host name or an IP address | 127.0.0.1 |
hostname | The host name of the server to be displayed in service EPRs, WSDLs etc. This parameter takes effect only when the WSDLEPRPrefix parameter is not set. | No | A host name or an IP address | localhost |
WSDLEPRPrefix | A URL prefix which will be added to all service EPRs and EPRs in WSDLs etc. | No | A URL of the form <protocol>://<hostname>:<port>/ | Â |
Transport sender parameters
Parameter Name | Description | Requried | Possible Values | Default Value |
---|---|---|---|---|
http.proxyHost | If the outgoing messages should be sent through an HTTP proxy server, use this parameter to specify the target proxy. | No | A host name or an IP address | Â |
http.proxyPort | The port through which the target proxy accepts HTTP traffic. | No | A positive integer less than 65535 | Â |
http.nonProxyHosts | The list of hosts to which the HTTP traffic should be sent directly without going through the proxy. | No | A list of host names or IP addresses separated by '|' | Â |
non-blocking | Setting this parameter to true is vital for reliable messaging and a number of other scenarios to work properly. | Yes | true | Â |
HTTP PassThrough transport
HTTP PassThrough Transport is the default, non-blocking HTTP transport implementation based on HTTP Core NIO and is specially designed for streaming messages. It is similar to the old message relay transport, but it does not care about the content type and simply streams all received messages through. It also has a simpler and cleaner model for forw arding messages back and forth. It can be used as an alternative to the NHTTP transport.Â
The HTTP PassThrough Transport is enabled by default. If you want to use the NHTTP transport instead, uncomment the relevant NHTTP transport entries in axis2.xml
and comment out the HTTP PassThrough transport entries. T he PassThrough Transport does not require the binary relay builder and expanding formatter.
Connection throttling
With the HTTP PassThrough and HTTP NIO transports, you can enable connection throttling to restrict the number of simultaneous open connections. To enable connection throttling, edit the <PRODUCT_HOME>/repository/conf/nhttp.properties
(for the HTTP NIO transport) or <PRODUCT_HOME>/repository/conf/passthru.properties
(for the PassThrough transport) and add the following line: max_open_connections = 2
This will restrict simultaneous open incoming connections to 2. To disable throttling, delete the max_open_connections
setting or set it to -1.
Connection throttling is never exact. For example, setting this property to 2 will result in roughly two simultaneous open connections at any given time.
WSO2 products do not use the HTTP/S servlet transport configurations that are in axis2.xml
file. Instead, they use Tomcat-level servlet transports, which are used by the management console in <PRODUCT_HOME>/repository/conf/tomcat/catalina-server.xml
 file.