use of com.hivemq.client.mqtt.datatypes.MqttQos in project open-smart-grid-platform by OSGP.
the class MqttClient method subscribe.
public void subscribe(final MessageHandler messageHandler) {
if (this.isDisconnected()) {
LOGGER.warn("Skipping subscribe, MQTT Client {} is disconnected", this.clientIdentifier);
return;
} else if (this.isWaitingForReconnect()) {
LOGGER.warn("Skipping subscribe, MQTT Client {} is waiting for reconnect", this.clientIdentifier);
return;
}
final MqttQos qos = MqttQos.valueOf(this.mqttClientDefaults.getDefaultQos());
Arrays.stream(this.mqttClientDefaults.getDefaultTopics()).forEach(topic -> {
this.unsubscribe(topic);
this.subscribe(topic, qos, messageHandler);
});
}
use of com.hivemq.client.mqtt.datatypes.MqttQos in project joynr by bmwcarit.
the class HivemqMqttClient method safeParseQos.
private MqttQos safeParseQos(int qosLevel) {
MqttQos result = MqttQos.fromCode(qosLevel);
if (result == null) {
result = MqttQos.AT_LEAST_ONCE;
logger.error("{}: Got invalid QoS level {} for publish, using default: {}", clientInformation, qosLevel, result.getCode());
}
return result;
}
Aggregations