2

I have been working on creating TCP socket server using spring integration, with the reference from this post I am able to setup socket connection.

My requirement has 4 clients which establish socket connection with the server. How can I handle concurrent requests from all the 4 clients. what changes has to be done at TcpReceivingChannelAdapter.

Could someone help me out.

merla
  • 489
  • 1
  • 5
  • 12

1 Answers1

2

The concern isn't clear. The TcpNetServerConnectionFactory (any AbstractConnectionFactory) uses an Executor to distribute work from the established connections. And by default it is like:

if (this.taskExecutor == null) {
    this.privateExecutor = true;
    this.taskExecutor = Executors.newCachedThreadPool();
}

So, this says to us that indeed all the 4 clients are going to be handled on the server concurrently.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • My concern is to handle multiple client connections concurrently. so as per your comments, the TcpNetServerConnectionFactory by default handles concurrent connections without any need to implement executor service? – merla Mar 29 '18 at 14:56
  • Correct. You always can inject any other `TaskExecutor` to the `ConnectionFactory` – Artem Bilan Mar 29 '18 at 14:57
  • ThankYou for your answer.Appreciate it!! – merla Mar 29 '18 at 15:15