INT-1008 Documentation for the Simple Outbound TCP Gateway.

This commit is contained in:
Gary Russell
2010-05-01 23:38:48 +00:00
parent c9bed59341
commit 23328adf6b

View File

@@ -195,20 +195,34 @@
</para>
</section>
<section id="tcp-gateways">
<title>TCP Gateway</title>
<title>TCP Gateways</title>
<para>
The simple inbound TCP gateway <classname>SimpleTcpNetInboundGateway</classname>
uses <classname>java.net.Socket</classname> for communications. Each connection
The simple inbound TCP gateway <classname>SimpleTcpNetInboundGateway</classname>
and simple oubound TCP gateway <classname>SimpleTcpNetOutboundGateway</classname>
use <classname>java.net.Socket</classname> for communications. Each connection
can process a single request/response at a time.
</para>
<para>
This gateway delegates to a subclass of the <classname>TcpNetReceivingChannelAdapter</classname>
described above, so please read that section for more information. The difference
is that after constructing a message with the incoming payload and sending
The inbound gateway delegates to a subclass of the <classname>TcpNetReceivingChannelAdapter</classname>
described above, so please read that section for more information. After
constructing a message with the incoming payload and sending
it to the requestChannel, it waits for a response and sends the payload
from the response message by writing it to the socket, using the same
message format configured for the incoming message.
</para>
<para>
The outbound gateway delegates to a <classname>TcpNetSendingMessageHandler</classname>
described above, so please read that section for more information. After
sending a message over the socket, the thread waits for a response and
constructs a response message with a byte[] payload The incoming
response is decoded using the same
message format configured for the outgoing message. Communications over
the socket are single-threaded. Users should be aware that only one
message can be handled at a time and if another thread attempts to send
a message before the current response has been received, it will block. Only
when the inprocess message receives a response (or times out based on the
socket timeout option) will it proceed.
</para>
<para>
<programlisting language="xml"><![CDATA[ <ip:inbound-gateway id="gatewayCrLf"
port="1234"
@@ -218,6 +232,15 @@
A simple inbound TCP gateway; it uses '/r/n' delimited data and can be
used by a simple client such as telnet.
</para>
<para>
<programlisting language="xml"><![CDATA[ <ip:outbound-gateway id="simpleOutGateway"
request-channel="tcpChannel"
message-format="crlf"
host="localhost"
port="1234"
/>]]></programlisting>
A simple oubound TCP gateway; it uses '/r/n' delimited data.
</para>
</section>
<section id="ip-endpoint-reference">
<title>IP Endpoint Attributes</title>
@@ -650,6 +673,86 @@
</tbody>
</tgroup>
</table>
<table id="tcp-ob-gateway-attributes">
<title>TCP Outbound Gateway Attributes</title>
<tgroup cols="3">
<colspec align="left" />
<colspec colnum="1" colname="col1" colwidth="1*"/>
<colspec colnum="2" colname="col4" colwidth="1*"/>
<colspec colnum="3" colname="col5" colwidth="3*"/>
<thead>
<row>
<entry align="center">Attribute Name</entry>
<entry align="left">Allowed Values</entry>
<entry align="center">Attribute Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>host</entry>
<entry></entry>
<entry>The host name or ip address of the destination.</entry>
</row>
<row>
<entry>port</entry>
<entry></entry>
<entry>The port to which the gateway connects.</entry>
</row>
<row>
<entry>receive-buffer-size</entry>
<entry></entry>
<entry>The size of the
buffer used to reassemble incoming messages. Effectively the maximum
message size that can be received.</entry>
</row>
<row>
<entry>message-format</entry>
<entry>length-header, stx-etx, crlf, custom</entry>
<entry>The formatting that the tcp gateway uses for formating
requests and demarcating
incoming responses. Defaults to length-header.
See the discussion above for details about each format.</entry>
</row>
<row>
<entry>custom-socket- reader-class-name</entry>
<entry>Subclass of TcpNetSocket- Reader</entry>
<entry>When message-format is 'custom' the name of the class that
implements the custom format. Must be a subclass of the
TcpNetSocketReader.</entry>
</row>
<row>
<entry>custom-socket- writer-class-name</entry>
<entry>Subclass of TcpNetSocket- Writer</entry>
<entry>When message-format is 'custom' the name of the class that
implements the custom format. Must be a subclass of the
TcpNetSocketWriter.</entry>
</row>
<row>
<entry>so-timeout</entry>
<entry></entry>
<entry>See <classname>java.net.Socket</classname>
setSoTimeout() for more information.</entry>
</row>
<row>
<entry>so-send-buffer-size</entry>
<entry></entry>
<entry>See <classname>java.net.Socket</classname>
setSendBufferSize() methods for more information.</entry>
</row>
<row>
<entry>so-receive-buffer- size</entry>
<entry></entry>
<entry>See <classname>java.net.Socket</classname>
setReceiveBufferSize() for more information.</entry>
</row>
<row>
<entry>so-keep-alive</entry>
<entry>true, false</entry>
<entry>See <classname>java.net.Socket. setKeepAlive()</classname>.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</section>
</chapter>