Exactor for genstage?


Is there an exactor version for genstage? I feel like Iโ€™m duplicating my code across different processes :confused: just wondering if there is an easier way to simplify?

Thanks! :slight_smile:

Avoiding code duplication is definitely a good thing, but Iโ€™m not personally a big fan of the approach taken by ExActor. I think the macros end up producing a bit too much magic in my view. If you post some of the code that youโ€™re trying to refactor we could perhaps offer some suggestions?


Sorry for the late reply, got caught up with other things.

Here is some of my code:

  def start_link(init \\ {}) do
    GenStage.start_link(__MODULE__, init, name: __MODULE__)

  # Callbacks
  def init(_state) do
    {:producer, 0}

  defp schedule_work() do
    Process.send_after(self(), {:work},  60 * 1000)

  def handle_info({:work}, state) do
     <generate data>

then I feel like I have to copy and paste the whole thing if I want to have a different ````` part so I thought of ExActor would simplify it.

Thanks! =)