Skip to content

Commit

Permalink
Fixing #276 to use connector ident in clientId
Browse files Browse the repository at this point in the history
  • Loading branch information
switschel committed Oct 21, 2024
1 parent bb92c56 commit 9d6cc1e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public MQTTServiceClient() {
null));
configProps.put("clientId",
new ConnectorProperty(true, 5, ConnectorPropertyType.ID_STRING_PROPERTY, true, true,
MQTTServiceClient.nextId(), null));
null, null));
configProps.put("useSelfSignedCertificate",
new ConnectorProperty(false, 6, ConnectorPropertyType.BOOLEAN_PROPERTY, true, true, false, null));
configProps.put("fingerprintSelfSignedCertificate",
Expand All @@ -81,6 +81,9 @@ public MQTTServiceClient() {
private static String nextId() {
return "CUMULOCITY_MQTT_SERVICE" + Integer.toString(random.nextInt(Integer.MAX_VALUE - 100000) + 100000, 36);
}
private static String getClientId(String ident) {
return "CUMULOCITY_MQTT_SERVICE" + ident;
}
// return random.nextInt(max - min) + min;

public MQTTServiceClient(ConfigurationRegistry configurationRegistry,
Expand Down Expand Up @@ -111,6 +114,8 @@ public MQTTServiceClient(ConfigurationRegistry configurationRegistry,
getConnectorSpecification().getProperties().put("password",
new ConnectorProperty(true, 3, ConnectorPropertyType.SENSITIVE_STRING_PROPERTY, true, true,
msc.getPassword(), null));
getConnectorSpecification().getProperties().put("clientId", new ConnectorProperty(true, 5, ConnectorPropertyType.ID_STRING_PROPERTY, true, true,
getClientId(this.connectorIdent), null));
this.supportedQOS = Arrays.asList(QOS.AT_LEAST_ONCE, QOS.AT_MOST_ONCE);
}

Expand Down

0 comments on commit 9d6cc1e

Please sign in to comment.