protected function execute(InputInterface $input, OutputInterface $output)
{
$this->define();
$serializer = $this->getContainer()->get('rs_queue.serializer');
$psubscriberCommand = $this;
$methods = $this->methods;
$patterns = array_keys($methods);
if ($this->shuffleQueues()) {
shuffle($patterns);
}
$this->getContainer()->get('rs_queue.redis')->psubscribe($patterns, function ($redis, $pattern, $channel, $payloadSerialized) use($methods, $psubscriberCommand, $serializer, $input, $output) {
$payload = $serializer->revert($payloadSerialized);
$method = $methods[$pattern];
/**
* All custom methods must have these parameters
*
* InputInterface $input An InputInterface instance
* OutputInterface $output An OutputInterface instance
* Mixed $payload Payload
*/
$psubscriberCommand->{$method}($input, $output, $payload);
});
}