Open RodolfoSilva opened 9 months ago
@derekkraan, would it be possible to add this feature to Horde, similar to what you did in Highlander?
Is there a reason to not just use Highlander in this situation? It is what I would recommend in any case.
@derekkraan It seems that Highlander doesn’t rebalance or distribute processes across the cluster; it only ensures that a process will run on a single node and, if the process dies, brings it back up.
I’m not sure if Horde was designed for this purpose, but we observe that services are well-distributed across the cluster.
In my case, I'm using Broadway with RabbitMQ, and I need to have only one instance of Broadway running across the entire cluster. I have a few workflows with this limitation. Using Highlander, it seems they are spawned only on a single node.
Maybe I'm doing something wrong, and this could be achieved with Highlander...
Aha, I see what you are getting at now. Highlander does not indeed solve this use case. Horde can do it, but only with a little bit of hacking, since DynamicSupervisor was meant for dynamic children, not static ones. I would not call it a durable solution however.
I'm not sure if Horde was designed for this purpose
So actually it wasn't, although I understand why you want this.
Do you have any suggestions on how we can achieve this behavior?
I unfortunately don't have any suggestions at this point in time. You could continue to use Horde like you are right now.
I will think about providing something to solve for this problem in HordePro. If you would be interested in beta testing that, you can sign up for the beta here.
@derekkraan, is this the correct way to start workers with the application? I was wondering if there is a better approach to initiate some jobs and automatically restart these jobs if they crash.
If so, can I add this to the documentation?
application.ex
supervisor.ex
I've made this inspired in this test:
https://github.com/derekkraan/horde/blob/065ffd49e660aa88648cddf6294a675963fa3eea/test/nested_supervision_test.exs#L29-L46