1
votes

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.

2
What version of Apollo are you using?Hiram Chirino

2 Answers

2
votes

I suspect the topic is being auto deleted once there are no producers or consumers attached to the topic. To disable auto delete 'feature', add the following XML element within the virual_host config element in apollo.xml:

<topic auto_delete_after="0"/>

Future versions of apollo will avoid deleting the topic when holds a retained message APLO-319 .

0
votes

This seems like a bug, since you have marked the messages as retained. However, I do not know how Apollo behaves regarding multiple retained messages on a topic. You may want to raise this on their mailing list.