0
votes

In spring Documentation --> 32.6 TCP Adapters it is mentioned that we use clientMode = "true" then the inbound adapter is responsible for the connection with external server.

I have created a flow in which the TCP Adapter with client connection factory makes connection with external server the code for the flow is :

IntegrationFlow flow = IntegrationFlows.from(Tcp.inboundAdapter(Tcp.nioClient(hostConnection.getIpAddress(),Integer.parseInt(hostConnection.getPort()))
             .serializer(customSerializer)
             .deserializer(customSerializer)
             .id(hostConnection.getConnectionNumber())).clientMode(true).retryInterval(1000).errorChannel("testChannel").id(hostConnection.getConnectionNumber()+"adapter"))
             .enrichHeaders(f->f.header("CustomerCode",hostConnection.getConnectionNumber()))
             .channel(directChannel())
             .handle(Jms.outboundAdapter(ConnectionFactory())
             .destination(hostConnection.getConnectionNumber()))
             .get();

     theFlow = this.flowContext.registration(flow).id(hostConnection.getConnectionNumber()+"outflow").register(); 
  • I have created multiple flow by iterating over the list of connections and iterate the above code in for loop and register them in flowcontext with unique ID.

My clients are created successfully with no issue and then establish there connection as supported by topology.

Issue :

  • I have counted the number of client connection created successfully so I have counted that 7 client connection (7 Integration flow) made successfully and they initiate connection from themselves.

  • when I create 8th client connection (8th flow created and registered successfully) but the .clientMode(true) is not working means the client don't initiate connection itself after first failure means it try for the first time to make connection if connected successfully then no issue but in case of failure it don't retry again.

  • Also my other created clients i.e 7 clients connection which are created successfully they also stopped initiating connection from itself when they got disconnected.

Note: There is no issue with flow only the TCP Adapters they stop initiating the connection

  • The flow is created and registered successfully as there is no issue it is because when I run a control bus command @adapter_id.retryConnection() it got connected with the server.

I don't understand that what is the issue with my flow that i couldn't initiate a connection after a particular count i.e seven or is there limitation in creating number of clients.

1

1 Answers

0
votes

One possibility is the taskScheduler's thread pool is exhausted - that shouldn't happen with the above configuration, but it depends on what else is in the application. Take a thread dump (e.g. jstack) to see what the taskScheduler threads are doing.

See the documentation for information about how to configure the threads in the scheduler. However, if it solves it, you should really figure out what task(s) are using scheduler threads for long tasks.

Also turn on DEBUG logging to see if it provides any clues.