RabbitMQ stops delivering MQTT messages to consumer after consumer restarts

17 views
Skip to first unread message

Marc Walter

unread,
Dec 5, 2017, 8:20:28 AM12/5/17
to MQTT
I have a RabbitMQ V3.6.10 instance on OpenShift running with the MQTT plugin enabled. And I have multiple Spring Boot applications with the Eclipse PAHO MQTT implementation consuming messages from a RabbitMQ queue. All consumers use MqttDefaultFilePersistence. The persistence data is written to a directory /tmp/mqtt on a persistent volume with a 100M quota. This is the code I wrote to connect to the RabbitMQ queues:

MqttConnectOptions options = new MqttConnectOptions();
options
.setUserName(username);
options
.setPassword(password.toCharArray());
options
.setCleanSession(false);
options
.setAutomaticReconnect(reconnect);
MqttClient mqttClient = new MqttClient(serverUri, "MyConsumerApp", new MqttDefaultFilePersistence("/tmp/mqtt"));
mqttClient
.connect(options);

Now I recognized that for some reasons if a cosumer app is restarted it does not consume any messages anymore. The messages in the queues are filling up as I can see in the RabbitMQ management console. There are no error messages in the RabbitMQ logs. The only solution that works in this case is deleting the subscription queue in the RabbitMQ management console and restarting the consumer application again. Maybe someone encountered similar issues? Does anyone have a hint for me what's going on here? Maybe there is an issue with the MQTT plugin RabbitMQ uses and the PAHO implementation holding message state. Looks like RabbitMQ does not know where to resume after consumer disconnected so it just stops delivering messages. Kinda pessimistic locking... :-)
Reply all
Reply to author
Forward
0 new messages