Data forwarding from child to parent process in Elixir

Im having three level system

Master Supervisor
Supervisor
Worker

application.ex handles master_supervisor.ex
master_supervisor.ex uses dynamic supervisor, it can invoke as many as supervisors
supervisor.ex also uses dynamic supervisor, it can invoke as many as workers

workers currently read data from a file and print it in iex.

Now, i want this data to move forward, i.e., the data from the reader should move forward to it’s corresponding supervisor, and the data should move also above one level to the mastersupervisor. How to do.

I also have another doubt like how to show this all in separate iex.

Thanks! :smiley:

This I think is a mistaken understanding of what the role of supervision is. Supervisors manage the life of children in the sense that they get them started and they can restart them to known good states, but they aren’t data coordinators. You don’t pass data up and down supervision trees.

If you want essentially a multiprocess data transformation pipeline check out Flow if you want an off the shelf version, or you can roll your own depending on how work is enqueued.

2 Likes

That’s not what Supervisor processes do. You should look into Flow, Broadway, Oban.

1 Like