Skip to content

Commit

Permalink
Issue eclipse-ditto#878: Use connection ID as client ID if the connec…
Browse files Browse the repository at this point in the history
…tion has 1 client.

Signed-off-by: Yufei Cai <yufei.cai@bosch.io>
  • Loading branch information
yufei-cai committed Nov 30, 2020
1 parent e7d5e2c commit a3cfd91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,11 @@ public void onConnectivityConfigModified(final ConnectivityConfig modifiedConfig
* @return the client ID.
*/
protected String getClientId(final CharSequence prefix) {
return prefix + "-" + actorUUID;
if (connection.getClientCount() == 1) {
return prefix.toString();
} else {
return prefix + "-" + actorUUID;
}
}

private boolean hasInboundMapperConfigChanged(final ConnectivityConfig connectivityConfig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ private AbstractMqttSubscriptionHandler<S, P, R> getSubscriptionHandler() {
}

private String distinguishClientIdIfNecessary(final String configuredClientId) {
if (connection.getClientCount() == 1 || configuredClientId.isEmpty()) {
if (configuredClientId.isEmpty()) {
return configuredClientId;
} else {
return getClientId(configuredClientId);
Expand Down

0 comments on commit a3cfd91

Please sign in to comment.