Skip to content

[Scheduler] events? #49803

Closed as not planned
Closed as not planned
@kbond

Description

@kbond

Description

I know when using the scheduler with messenger, you can use worker message events but I wonder if we should add scheduler-specific events? The stand-alone Scheduler could benefit.

Example

I think it could be nice DX to define events when defining your schedule:

public function getSchedule(): Schedule
{
    return (new Schedule())
        ->add(RecurringMessage::cron('* * * * *', new DoSomething()))
        ->before(function(PreRunEvent $event) {})
        ->after(function(PostRunEvent $event) {})
        ->onFailure(function(FailureEvent $event) {})

        // maybe some out of the box helpers
        ->emailOnFailure(...) // uses symfony/mailer
        ->notifyOnFailure(...) // uses symfony/notifier
        ->pingBefore('https://some-uptime-service.com/oihjnjf8sd')
        ->pingAfter('https://some-uptime-service.com/jdhdud832hd')
        ->pingOnFailure('https://some-uptime-service.com/8978df7d')
    ;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions