0
votes

I am now coding based on https://github.com/spring-projects/spring-integration-samples/tree/master/basic/tcp-client-server

I want to know monitoring information for this good source example.

For example, I want to know about how many clients are connected? how many threads are being used ?

Is there anybody who can replay about my question.

1

1 Answers

0
votes

You can use this on the AbstractConnectionFactory:

/**
 * Returns a list of (currently) open {@link TcpConnection} connection ids; allows,
 * for example, broadcast operations to all open connections.
 * @return the list of connection ids.
 */
public List<String> getOpenConnectionIds() {
    return Collections.unmodifiableList(this.removeClosedConnectionsAndReturnOpenConnectionIds());
}

The threads stats you can get from the externally configured ThreadPoolTaskExecutor and injected to that AbstractConnectionFactory via:

/**
 * @param taskExecutor the taskExecutor to set
 */
public void setTaskExecutor(Executor taskExecutor) {
    this.taskExecutor = taskExecutor;
}