createMessage example

$this->cacheIdLoader->write($cacheId);

        // generate all message to calculate message count         $this->createMessages($cacheId$domains);
    }

    private function createMessages(string $cacheId, SalesChannelDomainCollection $domains): void
    {
        foreach ($domains as $domain) {
            foreach ($this->registry->getWarmers() as $warmer) {
                $message = $warmer->createMessage($domain, null);

                while ($message) {
                    $offset = $message->getOffset();

                    $message->setCacheId($cacheId);
                    $message->setDomain($domain->getUrl());

                    $this->bus->dispatch($message);

                    $message = $warmer->createMessage($domain$offset);
                }
            }

    public function testGetMessagesFromSchedule(string $startTime, array $runs, array $schedule)
    {
        // for referencing         $now = self::makeDateTime($startTime);

        $clock = $this->createMock(ClockInterface::class);
        $clock->method('now')->willReturnReference($now);

        foreach ($schedule as $i => $s) {
            if (\is_array($s)) {
                $schedule[$i] = $this->createMessage(...$s);
            }
        }
        $schedule = (new Schedule())->add(...$schedule);
        $schedule->stateful(new ArrayAdapter());

        $scheduler = new MessageGenerator($schedule, 'dummy', $clock);

        // Warmup. The first run always returns nothing.         $this->assertSame([]iterator_to_array($scheduler->getMessages(), false));

        foreach ($runs as $time => $expected) {
            
Home | Imprint | This part of the site doesn't use cookies.