2

I want to configure Symfony Mail component to send different types of emails using different queue priorities. How can I do it?

So far I configured the queues:

framework:
    messenger:
        transports:
            async_low: '%env(MESSENGER_TRANSPORT_DSN_LOW)%'
            async_high: '%env(MESSENGER_TRANSPORT_DSN_HIGH)%'

        routing:
            'Symfony\Component\Mailer\Messenger\SendEmailMessage':  async_high

Then I started the queue with async_high being processed first:

bin/console messenger:consume async_high async_low

Now I would like to send one type of email form higher priority queue than the other:

$this->mailer->send($newsletterEmail); // 10.000 times
$this->mailer->send($resetPasswordEmail); // Triggered after newsletter

Without priorities the password reset would be sent after an hour (after all the newsletters get processed).
How can I send the newsletters using the lower priority queue?

HubertNNN
  • 1,727
  • 1
  • 14
  • 29

0 Answers0