The TCP transport is used for creating OpenWire/TCP endpoints. The NIO transport is similar to the TCP transport, except that it uses the Java New I/O (NIO) socket library, which can provide better scalability when used on the server side. TCP and NIO have the same transport options.
A TCP URI has the following syntax:
tcp://Host
[:Port
]?transportOptions
An NIO URI has the following syntax:
nio://Host
[:Port
]?transportOptions
Where the transport options, transportOptions
, are specified
as follows:
?option
=value
&option
=value
&...
In XML configuration, you must escape the &
symbol, replacing it with
&
. For example:
?option
=value
&option
=value
&...
When setting a client-side option, the name of the options is exactly as given in Table A.1. For example, to enable tracing on a client TCP
endpoint, set the trace
option as follows:
tcp://fusesource.com:61616?trace=true
When setting a server-side option, there are two alternative option syntaxes as follows:
- TCP listener socket options
To configure options on the TCP listener socket, add the
transport.
prefix to the option names shown in Table A.1. For example, to enable tracing on a TCP listener socket, set thetrace
option as follows:tcp://fusesource.com:61616?transport.trace=true
- TCP connection socket options
To configure options on a TCP connection socket (which is spawned from the listener socket whenever the server accepts a new TCP connection), use the option name exactly as given in Table A.1. For example, to enable tracing on a TCP connection socket, set the
trace
option as follows:tcp://fusesource.com:61616?trace=true
Table A.1 shows the options supported by the TCP and the NIO URIs.
Table A.1. TCP and NIO Transport Options
Option | Default | Description |
---|---|---|
minmumWireFormatVersion | 0 | The minimum wire format version that is allowed. |
trace | false | Causes all commands sent over the transport to be logged. |
daemon | false | Specifies whether the transport thread runs as a daemon or not. Useful to enable when embedding in a Spring container or in a web container, to allow the container to shut down properly. |
useLocalHost | true | When true , causes the local machine's name to resolve to
localhost . |
socketBufferSize | 64*1024 | Sets the socket buffer size in bytes. |
keepAlive | false | When true , enables TCP
KeepAlive on the broker connection. Useful to ensure that inactive
consumers do not time out. |
soTimeout | 0 | Sets the socket timeout in milliseconds |
connectionTimeout | 30000 | A non-zero value specifies the connection timeout in milliseconds. A zero value means wait forever for the connection to be established. Negative values are ignored. |
closeAsync | true | The false value causes all sockets to be closed
synchronously. |
soLinger | MIN_INTEGER | When > -1, enables the SoLinger socket option with this value.
When equal to -1, disables SoLinger . (from 5.6.0). |
maximumConnections | MAX_VALUE | The maximum number of sockets the broker is allowed to create. |
diffServ | 0 | (Client only) The preferred Differentiated Services
traffic class to be set on outgoing packets, as described in RFC 2475. Valid integer
values are [0,64) . Valid string values are EF ,
AF[1-3][1-4] or CS[0-7] . With JDK 6, only works when the
Java Runtime uses the IPv4 stack, which can be done by setting the
java.net.preferIPv4Stack system property to true . Cannot
be used at the same time as the typeOfService option. |
typeOfService | 0 | (Client only) The preferred type of
service value to be set on outgoing packets. Valid integer values are
[0,256) . With JDK 6, only works when the Java Runtime uses the IPv4
stack, which can be done by setting the java.net.preferIPv4Stack system
property to true . Cannot be used at the same time as the
diffServ option. |
wireFormat | The name of the wire format to use. | |
wireFormat.* | All the properties with this prefix are used to configure the wireFormat. See Table A.4 for more information. |