Skip to content

Commit

Permalink
Adding Callback on MQTTConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
switschel committed Mar 15, 2024
1 parent 8dfb51e commit 09c28e2
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ tenant, isConnected(),
}
}
try {

mqttCallback = new MQTTCallback(dispatcher, tenant, MQTTClient.getConnectorType());

boolean useTLS = (Boolean) connectorConfiguration.getProperties().getOrDefault("useTLS", false);
boolean useSelfSignedCertificate = (Boolean) connectorConfiguration.getProperties()
.getOrDefault("useSelfSignedCertificate", false);
Expand Down Expand Up @@ -283,13 +280,14 @@ tenant, isConnected(),
// .maxDelay(10000, TimeUnit.MILLISECONDS).build())
.buildBlocking();
}
//Registering Callback
Mqtt3AsyncClient mqtt3AsyncClient = mqttClient.toAsync();
mqtt3AsyncClient.publishes(MqttGlobalPublishFilter.ALL, mqttCallback);

// mqttClient.setCallaBack(mqttCallback);
// MqttConnectOptions connOpts = new MqttConnectOptions();
// connOpts.setCleanSession(true);
// connOpts.setAutomaticReconnect(false);
// log.info("Tenant {} - DANGEROUS-LOG password: {}", tenant, password);

Mqtt3ConnAck ack = mqttClient.connect();
if (!ack.getReturnCode().equals(Mqtt3ConnAckReturnCode.SUCCESS)) {
throw new ConnectorException("Tenant " + tenant + " - Error connecting to broker:"
Expand Down

0 comments on commit 09c28e2

Please sign in to comment.