commanded/commanded-scheduler

Support for Commanded 1.0

brentjanderson opened this issue · 5 comments

Upgrading to v1.0 breaks commanded_scheduler with the following error:

== Compilation error in file lib/commanded/scheduler/scheduling/scheduling.ex ==
** (ArgumentError) Commanded.Scheduler.Scheduling expects :application option
    lib/commanded/event/handler.ex:332: Commanded.Event.Handler.compile_config/2
    lib/commanded/scheduler/scheduling/scheduling.ex:4: (module)
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6

PR incoming with a naive patch, I'm not sure what the right pattern is for supporting multiple applications but it does work for a single application. I'd love feedback on how to do this right.

As a followup for those who might run across this same issue/PR - I switched over to using Oban for my particular use case. My Elixir chops aren't quite good enough to create this PR on my own.

Hi, @slashdotdash I love commanded but I noticed that commanded-scheduler is pretty outdated, doesn't work with commanded 1.0 and last update was at January. So my question is if you plan to support it in the future or I shouldn't count on it.

Thanks for the response

@Sgiath I don't have any current plans to upgrade it. Using Commanded v1.x would allow a separate Commanded application and event store to be used for scheduling which would make it more self-contained. That is a worthwhile upgrade.

@Sgiath I don't have any current plans to upgrade it. Using Commanded v1.x would allow a separate Commanded application and event store to be used for scheduling which would make it more self-contained. That is a worthwhile upgrade.

@slashdotdash In Commanded 1.0 apps you build, do you have some new method for handling timeouts if not this scheduler? I am finding myself rebuilding something kinda like the scheduler to handle these -- timeouts for reservations seem like a relatively common pattern in the world of eventual consistency. Maybe the answer is something like 'just use schedex / rihanna / oban'?

Maybe the answer is something like 'just use schedex / rihanna / oban'?

Yes, I would just use an external job queue such as Rihanna which has Rihanna.schedule/2 to schedule a job. A Commanded event handler can be used to schedule jobs from events.