|
42 | 42 | import org.osgi.util.converter.Converter;
|
43 | 43 | import org.osgi.util.converter.Converters;
|
44 | 44 |
|
| 45 | +import com.hivemq.client.mqtt.MqttClientState; |
| 46 | + |
45 | 47 | import in.bytehue.messaging.mqtt5.api.MqttCommandExtension;
|
46 | 48 | import in.bytehue.messaging.mqtt5.api.MqttMessageContextBuilder;
|
47 | 49 | import in.bytehue.messaging.mqtt5.provider.MessageClientProvider;
|
@@ -97,7 +99,7 @@ public String runtime(
|
97 | 99 | table.addRow("Connection URI", runtimeInfo.connectionURI);
|
98 | 100 | table.addRow("Connection Port", String.valueOf(client.config().port()));
|
99 | 101 | table.addRow("Connection SSL", String.valueOf(client.config().useSSL()));
|
100 |
| - table.addRow("Connection State", client.client.getState().toString()); |
| 102 | + table.addRow("Connection State", getState()); |
101 | 103 | table.addRow("Provider", runtimeInfo.providerName);
|
102 | 104 | table.addRow("Supported Protocols", converter.convert(runtimeInfo.protocols).to(String.class));
|
103 | 105 | table.addRow("Instance ID", runtimeInfo.instanceId);
|
@@ -137,7 +139,12 @@ public String runtime(
|
137 | 139 | return output.toString();
|
138 | 140 | }
|
139 | 141 |
|
140 |
| - @Descriptor("Subscribes to specific topic/filter with the input context") |
| 142 | + private String getState() { |
| 143 | + MqttClientState state = client.client.getState(); |
| 144 | + return state.isConnected() ? "CONNECTED" : "DISCONNECTED"; |
| 145 | + } |
| 146 | + |
| 147 | + @Descriptor("Subscribes to specific topic/filter with the input context") |
141 | 148 | public String sub(
|
142 | 149 |
|
143 | 150 | @Descriptor("Topic/Filter")
|
|
0 commit comments