Last active
September 11, 2019 22:36
-
-
Save mareksuscak/33d1ff7968fa594a2d724824d5912b6f to your computer and use it in GitHub Desktop.
Revisions
-
mareksuscak revised this gist
Sep 11, 2019 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,15 +2,16 @@ framework: messenger: # ... default_bus: command.bus buses: command.bus: # Will be run in the producer context (message sender) middleware: # Override the bus name that should receive and handle messages (bus name: consumer.bus) - App\Messenger\Middleware\AddConsumerBusNameStampMiddleware consumer.bus: # Will be run in the consumer context (message receiver -> worker) middleware: - doctrine_ping_connection - doctrine_transaction -
mareksuscak revised this gist
Sep 11, 2019 . No changes.There are no files selected for viewing
-
mareksuscak created this gist
Sep 11, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ <?php namespace App\Messenger\Middleware; use Symfony\Component\Messenger\Middleware\MiddlewareInterface; use Symfony\Component\Messenger\Middleware\StackInterface; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Stamp\BusNameStamp; # This is sort of a workaround, read more here: # https://github.com/symfony/symfony/issues/32436#issuecomment-530565499 final class AddConsumerBusNameStampMiddleware implements MiddlewareInterface { public function handle(Envelope $envelope, StackInterface $stack): Envelope { $envelope = $envelope->with(new BusNameStamp('consumer.bus')); return $stack->next()->handle($envelope, $stack); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ framework: messenger: # ... default_bus: messenger.bus.default buses: # Message producer bus (default) messenger.bus.default: # Override the bus name that should receive and handle messages (bus name: consumer.bus) - App\Messenger\Middleware\AddConsumerBusNameStampMiddleware # Message consumer bus consumer.bus: middleware: - doctrine_ping_connection - doctrine_transaction