Chapter 1. OpenWire over TCP
URI syntax
A vanilla TCP URI has the syntax shown in Example 1.1, “Syntax for a vanilla TCP Connection”.
Example 1.1. Syntax for a vanilla TCP Connection
tcp://Host[:Port]?transportOptions
An NIO URI has the syntax shown in Example 1.2, “Syntax for NIO Connection”.
Example 1.2. Syntax for NIO Connection
nio://Host[:Port]?transportOptions
Setting transport options
OpenWire transport options, transportOptions, are specified as a list of matrix parameters. How you specify the options to use differs between a client-side URI and a broker-side URI:
- When using a URI to open a connection between a client and a broker, you just specify the name of the option as shown.
Example 1.3. Setting an Option on a Client-Side TCP URI
tcp://fusesource.com:61616?trace=true
- When using a URI to open a broker listener socket, you prefix the option name with
transport.
as shown.Example 1.4. Specifying Transport Options for a Listener Socket
tcp://fusesource.com:61616?transport.trace=true
- When using a URI to open a broker connection socket, you just specify the name of the option as shown.
Example 1.5. Setting an Option on a Client-Side TCP URI
tcp://fusesource.com:61616?trace=true
Important
In XML configuration, you must escape the
&
symbol, replacing it with & as shown.
Example 1.6. Transport Options in XML
?option=value&option=value&...
Transport options
Table 1.1, “TCP and NIO Transport Options” shows the options supported by the TCP and the NIO URIs.
Option | Default | Description |
---|---|---|
minmumWireFormatVersion | 0 | Specifies 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 | Specifies, in milliseconds, the socket timeout. |
soWriteTimeout | 0 | Specifies, in milliseconds, the timeout for socket write operations. |
connectionTimeout | 30000 | Specifies, in milliseconds, the connection timeout. Zero means wait forever for the connection to be established. |
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 . |
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.1, “Wire Format Options Supported by OpenWire Protocol” for more information. | |
jms.* | All the properties with this prefix are used to configure client connections to a broker. See Appendix B, Client Connection Options for more information. |