Genstage overlaid on a supervisor

Quick design question–I have a gen_stage producer_consumer that receives events, does work on them, and emits an audit log of the work done.

I want to multiplex the work done across manually mounted systems. Each system is passed in or registered with the stage, receives every event, does its own thing, and returns audits back to the stage.

Off the top of my head it sounds like I want to make the stage not just a producer_consumer, but a dynamic (perhaps simple-one-for-one) supervisor. Of course the init behaviours conflict.

Has anyone done something like this before? What would be a good way to get this effect? I can’t think of a great architecture for this.

It’s key that the root module be compatible with a GenStage pipeline even if secretly it doesn’t directly use Genstage itself. Ideally all associated workers would start and stop as a unit with the root module’s start_link without further instruction.

1 Like

For posterity, answered (transitively, through this later question) in this discussion!

1 Like