Skip to content

Instantly share code, notes, and snippets.

@mmouih
Last active January 21, 2024 22:57
Show Gist options
  • Save mmouih/33d28670193572594aac8e347ab78eae to your computer and use it in GitHub Desktop.
Save mmouih/33d28670193572594aac8e347ab78eae to your computer and use it in GitHub Desktop.
WatchDog to monitor services
<?php
namespace App\Scheduler;
use App\Message\WatchDogMessage;
use Symfony\Component\Scheduler\Schedule;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Attribute\AsSchedule;
use Symfony\Component\Scheduler\ScheduleProviderInterface;
#[AsSchedule('watchdog')]
class WatchDogScheduleProvider implements ScheduleProviderInterface
{
public function getSchedule(): Schedule
{
return (new Schedule())->add(
RecurringMessage::every('5 seconds', new WatchDogMessage(['logger', 'imports', 'exports']))
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment