miwee/stomp_client

Supervision of stomp client

Closed this issue · 2 comments

Hi,
I was wondering if there are any examples about how to fit stomp_client into a supervision tree. Does it handle reconnects? What about a crashing callback handler?

Thanks

miwee commented

stomp_client is a GenServer, but it doesn't connect by default neither it handles reconnects. For supervision tree, create a GenServer which starts StompClient.start_link in its init routine and use something like Process.send_after(self(), {:init_connect}, 0) to hook StompClient.connect. The callback_handler will also be this same GenServer itself. Put this GenServer into any supervisor and it should handle most of the failure scenarios including reconnects and crashing callback_handler. I will try to put an example, using the above method in some time.

miwee commented

added examples/supervision_example.ex