Skip to content

Commit

Permalink
MQTT Username concatenate metrics query parameters (#264)
Browse files Browse the repository at this point in the history
Co-authored-by: Leonardo Nodari <[email protected]>
  • Loading branch information
bretambrose and TheNodi authored Apr 21, 2022
1 parent b69a8f5 commit b33b08c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,11 @@ public MqttClientConnection build() {
if (connectionConfig.getUsername() != null) {
usernameOrEmpty = connectionConfig.getUsername();
}
connectionConfig.setUsername(String.format("%s?SDK=JavaV2&Version=%s", usernameOrEmpty, new PackageInfo().version.toString()));
String queryStringConcatenation = "?";
if (usernameOrEmpty.contains("?")) {
queryStringConcatenation = "&";
}
connectionConfig.setUsername(String.format("%s%sSDK=JavaV2&Version=%s", usernameOrEmpty, queryStringConcatenation, new PackageInfo().version.toString()));

if (connectionConfig.getUseWebsockets() && connectionConfig.getWebsocketHandshakeTransform() == null) {
if (websocketCredentialsProvider == null) {
Expand Down

0 comments on commit b33b08c

Please sign in to comment.