[AMQ-9769] Add name property to connector interface and MBean.
Requested change:
- Please add getConnectionId() to ConnectionViewMBean
The connectionId is the unique value within the broker for the connection.
Side note: We should be registering JMX using that unique value instead of the clientId since clientId can be reused across connections and quickly swapped out if link stealing is enabled, but we won't dial up that change now.
Done, but now ConnectionView returns the same value for both getClientId and getConnectionId:
public String getClientId() {
return connection.getConnectionId();
}
public String getConnectionId() {
return connection.getConnectionId();
}
And connection.getConnectionId() executes the following code in TransportConnection class:
public String getConnectionId() {
List<TransportConnectionState> connectionStates = listConnectionStates();
for (TransportConnectionState cs : connectionStates) {
if (cs.getInfo().getClientId() != null) {
return cs.getInfo().getClientId();
}
return cs.getInfo().getConnectionId().toString();
}
return null;
}
So it may return either clientId or connectionId.
I propose to remove connection handling changes from this pull request and keep only changes to connector MBean and connector output in web UI.
@thezbyg can you please rebase and fix conflict ?
Rebased.
Connection clientId issue could be fixed by saving current clientId value when registering connection MBean. Like this: https://github.com/thezbyg/activemq/commit/53d7e53366b88ceb00d6f5a08aad5bd83c618891
This would ensure that clientId returned by connection.getClientId() could not change after MBean is registered and would always match connectionName property value in connection MBean object name.