GenStage, Plug, Hooks, ...

Hello,

I was thinking to create a system which let me to plug some functionalities in future like ejabberd or MongooseIM does with hooks:

The point is, if I have a dynamic pipeline created to process sequentially data, let me to include in that pipeline new code without modify the original code.

I thought in Plug but I’m not sure if, for a Plug created in other module I can modify it to include the call of other functions.

Also thought about GenStage and Flow, but the same, I’m not sure if I can deconstruct them to include extra processing in the same way.

Kind regards.