mosquito-cr / mosquito

A background task runner for crystal applications supporting periodic (CRON) and manually queued jobs
MIT License
227 stars 24 forks source link

overseers now publish lifecycle events #160

Closed robacarp closed 1 week ago

robacarp commented 1 week ago

fixes #158

ic(1.13.1):pry> subscriber = Mosquito::Api.event_receiver
 => #<Channel(Mosquito::Backend::BroadcastMessage):0x130395ec0>
ic(1.13.1):pry> 4.times { puts subscriber.receive }
Mosquito::Backend::BroadcastMessage(@channel="mosquito:overseer:4337188736", @message="{\"event\":\"executor-created\",\"executor\":4337158448}")
Mosquito::Backend::BroadcastMessage(@channel="mosquito:overseer:4337188736", @message="{\"event\":\"executor-created\",\"executor\":4337158336}")
Mosquito::Backend::BroadcastMessage(@channel="mosquito:overseer:4337188736", @message="{\"event\":\"executor-created\",\"executor\":4337158224}")
Mosquito::Backend::BroadcastMessage(@channel="mosquito:overseer:4337188736", @message="{\"event\":\"starting\"}")

Overseers now publish these events: