I have a problem by using fusesource code to publish mqtt messages to Apollo server. I wrote the message publisher with the code like the following
connection.publish(topic, message.getBytes(),QoS.AT_LEAST_ONCE, true);
I also wrote the message consumer which subscribes to the topic. If I started my consumer first and then the publisher, the consumer can obtain all messages correctly. However, if I start the publisher first and then the consumer, the consumer will not receive the messages. Also, I went into Apollo admin console and I could not find any messages in the queue. (Please see attached screen shot).
What should I do to fix this problem? I could not make my consumer running all the time and I don’t want to lose any messages from the publisher. Should not the broker (Apollo) keep all the messages when the consumers are offline? If yes, how come I could not see it?
This seems a silly question but I am pretty new to MQTT and I do need some help.