spring-integration-samples icon indicating copy to clipboard operation
spring-integration-samples copied to clipboard

What is required to make DynamicTcpClientApplication also return data with the send interface?

Open Syrou opened this issue 5 years ago • 2 comments

I'm trying to wrap my head around how to make the DynamicTcpClientApplication also give back the response data sent with:

	@MessagingGateway(defaultRequestChannel = "toTcp.input")
	public interface ToTCP {

		public void send(String data, @Header("host") String host, @Header("port") int port);

	}

Just changing from void to byte[] is not enough. What is needed to make sure a client can get the response from a tcp request back through the interface?

Syrou avatar Sep 18 '20 10:09 Syrou

Use gateways instead of channel adapters - see this commit https://github.com/garyrussell/spring-integration-samples/commit/901363d1796bd00fefcacd3a6073d79a4560b794

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.4.0-SNAPSHOT)

FOO
FOO

garyrussell avatar Sep 18 '20 14:09 garyrussell

Thanks, i'll be giving this a go in a week, i'll be getting back asap

Syrou avatar Sep 23 '20 09:09 Syrou