please, Can you help me?
All of source here it is.
(https://github.com/mcvzone/integration-tcp-test.git)
Thank you.
1. I created a spring integration-tcp-client context xml file.
<int:gateway id="gw"
service-interface="com.example.demo.module.SimpleGateway"
default-request-channel="input"/>
<int-ip:tcp-connection-factory id="client"
type="client"
host="localhost"
port="1234"
single-use="true"
so-timeout="10000"/>
<int:channel id="input"/>
<int-ip:tcp-outbound-gateway id="outGateway"
request-channel="input"
reply-channel="clientBytes2StringChannel"
connection-factory="client"
request-timeout="10000"
reply-timeout="10000"/>
<int:object-to-string-transformer id="clientBytes2String"
input-channel="clientBytes2StringChannel"/>
2. And I created a RestController.
@RestController
public class TcpController {
final GenericXmlApplicationContext context;
final SimpleGateway simpleGateway;
public TcpController(){
this.context = new GenericXmlApplicationContext();
context.load("classpath:META-INF/spring/integration/tcpClientServerDemo-context.xml");
context.registerShutdownHook();
context.refresh();
this.simpleGateway = context.getBean(SimpleGateway.class);
}
@RequestMapping("/tcp/test")
public String test(String name) {
//SimpleGateway simpleGateway = context.getBean(SimpleGateway.class);
String result = simpleGateway.send(name);
System.out.println("result : " + result);
return result;
}
}
3. I start spring boot and open 1234 port (new ServerSocket(1234)) and I call url.(http://localhost:8080/tcp/test)
4. It result is error.
java.lang.IllegalArgumentException: unable to determine a Message or payload parameter on method
.
.
.
at com.sun.proxy.$Proxy60.send(Unknown Source) ~[na:na]
at com.example.demo.TcpController.test(TcpController.java:25) ~[classes/:na]