$eventDispatcher->
addSubscriber($this->
getContainer()->
get(MessageQueueStatsSubscriber::
class));
/** @var ServiceLocator<ReceiverInterface> $locator */
$locator =
$this->
getContainer()->
get('messenger.test_receiver_locator'
);
/** @var ReceiverInterface $receiver */
$receiver =
$locator->
get('async'
);
/** @var MessageBusInterface $bus */
$bus =
$this->
getContainer()->
get('messenger.bus.test_shopware'
);
$worker =
new Worker([$receiver],
$bus,
$eventDispatcher);
$worker->
run([ 'sleep' => 1000,
]);
} abstract protected static function getContainer(): ContainerInterface;
}