/**
  * @param string $command serialized command object
  * @return string
  */
 public function actionHandle($command)
 {
     try {
         $command = unserialize(base64_decode($command));
         $command->setRunningInBackground(true);
         $this->commandBus->handle($command);
     } catch (\Exception $e) {
         Console::error($e->getMessage());
     }
 }
 /**
  * @param $job
  * @return mixed|string
  */
 protected function handle($job)
 {
     if (array_key_exists('serializer', $job['body'])) {
         $unserialize = $job['body']['serializer'][1];
         $command = call_user_func($unserialize, $job['body']['object']);
         if ($command instanceof QueuedCommand) {
             $command->setRunningInQueue(true);
             return $this->commandBus->handle($command);
         }
     }
     Console::error("Malformed job ID#{$job['id']}");
     $this->delete($job);
 }
<?php

$config = ['id' => 'app-console', 'basePath' => \Yii::getAlias('@tests'), 'runtimePath' => \Yii::getAlias('@tests/_output'), 'controllerMap' => ['migrate' => ['class' => \yii\console\controllers\MigrateController::className(), 'migrationPath' => dirname(\Yii::getAlias('@tests')) . '/src/migrations']], 'components' => ['scheduler' => ['class' => \understeam\scheduler\Scheduler::className(), 'executor' => ['class' => \understeam\scheduler\CommandBusExecutor::className(), 'commandBus' => 'commandBus']], 'db' => ['class' => \yii\db\Connection::className(), 'dsn' => 'sqlite:' . \Yii::getAlias('@tests/_output/scheduler.db')], 'commandBus' => \trntv\bus\CommandBus::className()]];
new yii\console\Application($config);