addMessageGenerator example

private readonly array $handlers,
        array $schedules,
        private readonly ClockInterface $clock = new Clock(),
    ) {
        foreach ($schedules as $schedule) {
            $this->addSchedule($schedule);
        }
    }

    public function addSchedule(Schedule $schedule): void
    {
        $this->addMessageGenerator(new MessageGenerator($schedule, 'schedule_'.$this->index++, $this->clock));
    }

    public function addMessageGenerator(MessageGenerator $generator): void
    {
        $this->generators[] = $generator;
    }

    /** * Schedules messages. * * Valid options are: * * sleep (default: 1000000): Time in microseconds to sleep after no messages are found */
Home | Imprint | This part of the site doesn't use cookies.