/** * Resubscribe to previously subscribed topics on reconnecting. */ void resubscribeToTopics() { LOGGER.info("Auto-resubscribe is enabled. Resubscribing to previous topics."); for (final AWSIotMqttTopic topic : topicListeners.values()) { if (mqttClient != null) { try { mqttClient.subscribe(topic.getTopic(), topic.getQos().asInt()); } catch (final MqttException e) { LOGGER.error("Error while resubscribing to previously subscribed toipcs.", e); } } } }
@Test public void testGetTopic() throws Exception { assertEquals("test-topic", topicModel.getTopic()); }
@Test public void testSetTopic() throws Exception { topicModel.setTopic("not-test-topic"); assertEquals("not-test-topic", topicModel.getTopic()); topicModel.setTopic("test-topic"); }
/** * Resubscribe to previously subscribed topics on reconnecting. */ void resubscribeToTopics() { LOGGER.info("Auto-resubscribe is enabled. Resubscribing to previous topics."); for (final AWSIotMqttTopic topic : topicListeners.values()) { if (mqttClient != null) { try { mqttClient.subscribe(topic.getTopic(), topic.getQos().asInt()); } catch (final MqttException e) { LOGGER.error("Error while resubscribing to previously subscribed toipcs.", e); } } } }