Subscribing to a topic and staying connected

32 views
Skip to first unread message

Paul Schulz

unread,
Jun 19, 2019, 11:46:30 PM6/19/19
to clojure-mqtt
Greetings,

I am using MQTT via Clojure/Machine Head, to connect(subscribe) to The Internet of Things MQTT service and receive messages from my IoT/LoRaWAN device.

With the examples provided I ave been able to subscribe to desired topic and receive messages.

After a short while (1-2 minutes, 1-3 messages) my Clojure code exits, and the program stops, and I am wondering why, and what I can do to stop it exiting.

After the machine head code is run to subscribe and register the callback function, the main program finishes (as per Machine Head examples).

- Would this exit be caused by garbage collection?
- Would a non exiting main function (loop + delay) solve the problem? (I'm about to go try this one.)

Regards,
Paul


thomas van der veen

unread,
Jun 24, 2019, 7:56:04 AM6/24/19
to clojure-mqtt
Hi Paul,

I think it is extremely unlikely for a GC to cause an exit. Could you maybe share some code and do you see any Exceptions?

Thomas
Reply all
Reply to author
Forward
0 new messages