Skip to content

Commit

Permalink
[QRT-4729] Added feature to show only CONNECTED and DISCONNECTED states
Browse files Browse the repository at this point in the history
  • Loading branch information
amitjoy committed Jul 8, 2024
1 parent df7cea8 commit 76c9588
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import org.osgi.util.converter.Converter;
import org.osgi.util.converter.Converters;

import com.hivemq.client.mqtt.MqttClientState;

import in.bytehue.messaging.mqtt5.api.MqttCommandExtension;
import in.bytehue.messaging.mqtt5.api.MqttMessageContextBuilder;
import in.bytehue.messaging.mqtt5.provider.MessageClientProvider;
Expand Down Expand Up @@ -97,7 +99,7 @@ public String runtime(
table.addRow("Connection URI", runtimeInfo.connectionURI);
table.addRow("Connection Port", String.valueOf(client.config().port()));
table.addRow("Connection SSL", String.valueOf(client.config().useSSL()));
table.addRow("Connection State", client.client.getState().toString());
table.addRow("Connection State", getState());
table.addRow("Provider", runtimeInfo.providerName);
table.addRow("Supported Protocols", converter.convert(runtimeInfo.protocols).to(String.class));
table.addRow("Instance ID", runtimeInfo.instanceId);
Expand Down Expand Up @@ -137,7 +139,12 @@ public String runtime(
return output.toString();
}

@Descriptor("Subscribes to specific topic/filter with the input context")
private String getState() {
MqttClientState state = client.client.getState();
return state.isConnected() ? "CONNECTED" : "DISCONNECTED";
}

@Descriptor("Subscribes to specific topic/filter with the input context")
public String sub(

@Descriptor("Topic/Filter")
Expand Down

0 comments on commit 76c9588

Please sign in to comment.