Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built In automatic Scheduler monitoring #52901

Open
qdequippe opened this issue Dec 5, 2023 · 1 comment
Open

Built In automatic Scheduler monitoring #52901

qdequippe opened this issue Dec 5, 2023 · 1 comment

Comments

@qdequippe
Copy link
Contributor

Description

Built In automatic scheduler message monitoring with combination of Webhook and RemoteEvent (PingWebhookMessage).

Example

First proposition is to add 2 different urls to ping, one in case of success and the other one in case of error.

public static function every(..., ?string $pingSuccessUrl = null, ?string $pingErrorUrl = null): self

And add a built in listener:

final class PingScheduleListener  
{  
    public function __construct(private readonly MessageBusInterface $bus)
    {
    }

    public function pingOnFailure(FailureEvent $event): void  
    {   
         $message = $event->getMessage();
         $this->ping($message->getPingErrorUrl());
    }  

    public function pingOnSuccess(PostRunEvent $event): void  
    {  
         $message = $event->getMessage();
         $this->ping($message->getPingSuccessUrl());
    }  

    private function ping(string $url): void
    {
        $this->bus->dispatch(new PingWebhookMessage('GET', $url);
    }
}
@noahlvb
Copy link

noahlvb commented Dec 14, 2023

I can see use cases for this myself. But I think making the code this concrete is not good. Perhaps adding events for succesful and failed cron event so that you can use the event dispatcher to add you own ping logic. This why people can add all their own logging and other behavoir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants