Files
spring-integration-samples/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpClientServerDemo-conversion-context.xml
Artem Bilan 9d02471346 Fix TCP tests to use OS-selected port (#224)
* Fix TCP tests to use OS-selected port

https://build.spring.io/browse/INTSAMPLES-NIGHTLY-2413

Modify all the `tcpclientserver` tests to rely on the OS-selected port,
in other words set `0` to the server port and get the real port for the
client when server is listening

* * Upgrade to Gradle-4.6
* Fix Travis config do not perform assemble task
2018-04-02 15:17:59 -04:00

84 lines
2.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd">
<description>
This version demonstrates the use of a conversion service and channel 'dataType'
instead of explicit transformers to convert from byte array to String.
</description>
<bean id="integrationConversionService"
class="org.springframework.context.support.ConversionServiceFactoryBean">
<property name="converters">
<list>
<bean class="org.springframework.integration.samples.tcpclientserver.ByteArrayToStringConverter"/>
</list>
</property>
</bean>
<context:property-placeholder/>
<!-- Client side -->
<int:gateway id="gw"
service-interface="org.springframework.integration.samples.tcpclientserver.SimpleGateway"
default-request-channel="input"
default-reply-channel="reply"/>
<int-ip:tcp-connection-factory id="client"
type="client"
host="localhost"
port="#{crLfServer.port}"
single-use="true"
so-timeout="10000"
/>
<int:channel id="input"/>
<int-ip:tcp-outbound-gateway id="outGateway"
request-channel="input"
reply-channel="reply"
connection-factory="client"
request-timeout="10000"
reply-timeout="10000"
/>
<!-- dataType attribute invokes the conversion service -->
<int:channel id="reply" datatype="java.lang.String"/>
<!-- Server side -->
<int-ip:tcp-connection-factory id="crLfServer"
type="server"
port="${availableServerSocket:0}"/>
<int-ip:tcp-inbound-gateway id="gatewayCrLf"
connection-factory="crLfServer"
request-channel="toSA"
error-channel="errorChannel"/>
<!-- dataType attribute invokes the conversion service -->
<int:channel id="toSA" datatype="java.lang.String"/>
<int:service-activator input-channel="toSA"
ref="echoService"
method="test"
/>
<bean id="echoService"
class="org.springframework.integration.samples.tcpclientserver.EchoService"/>
<int:transformer id="errorHandler"
input-channel="errorChannel"
expression="payload.failedMessage.payload + ':' + payload.cause.message"/>
</beans>