1
votes

Spring integration tcp gateway can be setup as follows:

<!-- Server side -->

<int-ip:tcp-connection-factory id="crLfServer"
    type="server"
    port="${availableServerSocket}"
    single-use="true"
    so-timeout="5000"
    using-nio="false" 
    />

<int-ip:tcp-inbound-gateway id="gatewayCrLf"
    connection-factory="crLfServer"
    request-channel="serverBytes2StringChannel"
    error-channel="errorChannel"
    reply-timeout="10000"/> 

My TCP server works perfectly fine and responds within 10 seconds.

Sometimes other important batch processes slow down my server processing. During that time, I would like to change reply-timeout dynamically.

How to change the reply-timeout dynamically in a running server?

1

1 Answers

2
votes

An so-timeout can be changed on the AbstractConnectionFactory bean via that crLfServer id.

The reply-timeout you can change on the TcpInboundGateway bean using its gatewayCrLf id.

Anyway you have to be sure that you restore everything back after those changes. Plus you application should ensure that nothing more get access to those components. Otherwise you'll end up with unexpected behavior.

On the other hand consider to provide other similar component but just for this particular task with desired timeouts.