sroze / messenger-enqueue-transport

Uses Enqueue with Symfony's Messenger component.
MIT License
191 stars 55 forks source link

[Symfony][4.3] Multienviroment support #100

Closed psociety closed 4 years ago

psociety commented 4 years ago

Hi! I'm using enqueue-dev + messenger-enqueue-transport in symfony with beanstalk, where i have multiple enviroments (.env). How should i setup so jobs from different enviroments don't get mixed in the same queue?

I run the jobs of each enviroment using: APP_ENV=qa bin/console messenger:consume beanstalk -vvv APP_ENV=production bin/console messenger:consume beanstalk -vvv

When i was using pheanstalk i just added a suffix on jobs name, but in symfony jobs are set using classes:

$message = new ReportMessage($reportUrl);
$this->bus->dispatch((new Envelope($message))->with(new DelayStamp(1000)));

(my old implementation):

$this->pheanstalk->useTube(JOB_REPORT_MESSAGE . APP_ENV)->put(json_encode($data));

Screenshot from 2020-04-27 11-39-04