Delay for message queue not available under Shopware 6.5?

131 views Asked by At

I have a subscriber that passes a message to the message queue, this gets a delay and is set to the message queue normally. Under Shopware 6.4 the delay is recognized, as soon as it expires the process is executed. However, this is not the case with Shopware 6.5, where the message is processed immediately and the delay is completely ignored. The function of the bus "dispatch" accepts it as a parameter, but it is not addressed in the function at all:

public function dispatch($message, array $stamps = []): Envelope
    {
        $envelope = $message instanceof Envelope ? $message : new Envelope($message);
        $this->envelopes[] = $envelope;

        return $envelope;
    }

A possible workaround would be to work with scheduled tasks. So that a free text field is set / filled and the Scheduled Task then processes these orders based on criteria. However, this is not the cleanest / best solution.

My question, is there a better workaround to pass a delay under Shopware 6.5 which is also recognized?

Thank you very much for possible solutions!

1

There are 1 answers

0
j_elfering On BEST ANSWER

Shopware uses the symfony messenger component under the hood, so the delay options should work (but based on the actual queue you use for message delivery, there might be some differences as stated in the documentation.

But in your case it looks like the message you dispatch isn't even dispatched to the queue and handled async, but is directly and synchronously executed. This should only happen when your queue or your message routing is not setup properly.

With shopware 6.5 the default queue name was changed to async so you'll need to configure that transport accordingly, as stated in the upgrade guide. ANd also make sure that your message implements the AsyncMessageInterface, so it is correctly routed to the correct queue (or alternatively configure the routing yourself over the default symfony config.