Publish command to queue.

@param Command $command

@return bool
17176
public function publish(Command $command)
    {
        $value = $this->serializer->serialize($command);

        return (bool) $this->client->rpush($this->queue_name, [$value]);
    }
184027
public function command($cmd, $q = '', $cb = null)
    {
        if ($this->phase !== self::PHASE_HANDSHAKED) {
            return false;
        }

        $this->onResponse->push($cb);
        $this->seq = 0;
        $this->sendPacket(chr($cmd) . $q);

        return true;
    }
1232751
final public function handle(Command $command): void
    {
        if (!$command instanceof ReceivedCommand && $this->discriminator->shouldEnqueue($command)) {
            $this->queue->send($command);

            return;
        }

        if ($command instanceof ReceivedCommand) {
            $command = $command->getOriginalCommand();
        }

        $this->wrappedCommandBus->handle($command);
    }
1261311
public function send(ClientCommand $command)
	{
		$request = $this->client->createRequest(
			$command->method(),
			$this->client->getBaseUrl() . $command->uri($this->cryptographyEngine),
			$this->headers($command->apiVersion(), $command->format(), $command->headers()),
			$command->body($this->cryptographyEngine),
			$this->config->getHttpClientConfig()
		);

		try {
			$response = $request->send();
		} catch (ClientErrorResponseException $exception) {
			$response = $exception->getResponse();
		} catch (ServerErrorResponseException $exception) {
			$response = $exception->getResponse();
		}

		return $command->response($response, $this->cryptographyEngine);
	}
1323673
protected function commandShouldBeQueued($command)
    {
        if ($command instanceof ShouldQueue) {
            return true;
        }

        return (new ReflectionClass($this->getHandlerClass($command)))->implementsInterface(
            'Illuminate\Contracts\Queue\ShouldQueue'
        );
    }
410218
public function fire(Command $command)
    {
        $this->command = $command;

        if ($command->option('verbose')) {
            $command->blockMessage('Requirements', 'Checking System Requirements ...', 'comment');
        }

        $this->checkPHPVersion();
        $this->checkExtensions();

        $this->showResults();
    }
253396
public function job($command)
    {
        $line = new Job($command, $this);
        $this->lines[] = $line;

        return $line;
    }
530396
public function fire(Command $command)
    {
        if ($command->option('verbose')) {
            $command->call('key:generate');
            $command->call('api:key-generate');

            return;
        }
        $command->callSilent('key:generate');
        $command->callSilent('api:key-generate');
    }
954568
public function run($command, $operation = 'default')
	{
		$this->output = null;

		try {
			$this->processInstance->setCommandLine($command);
			$this->processInstance->setTimeout(self::PROCESS_TIMEOUT);
			$this->processInstance->run();

			if (!$this->processInstance->isSuccessful()) {
				$this->output = $this->processInstance->getErrorOutput();

				return false;
			}
		} catch (Exception $exception) {
			$message = 'An error occurred that prevented the operation ' . $operation . ': ' . $exception->getMessage();

			switch ($operation) {
				case 'export':
					throw new BackupExportException($message);
				case 'restore':
					throw new BackupRestoreException($message);
				default:
					throw new BackupException($message);
			}
		}

		return true;
	}
292959
public function dispatchToQueue($command)
    {
        $connection = $command->connection ?? null;

        $queue = call_user_func($this->queueResolver, $connection);

        if (! $queue instanceof Queue) {
            throw new RuntimeException('Queue resolver did not return a Queue implementation.');
        }

        if (method_exists($command, 'queue')) {
            return $command->queue($queue, $command);
        }

        return $this->pushCommandToQueue($queue, $command);
    }
1262293
public function execute($command)
    {
        $validator = $this->translator->toValidator($command);

        if (class_exists($validator)) {
            $this->app->make($validator)->validate($command);
        }

        return $this->bus->execute($command);
    }
1295858
def command_publish(self, command, **kwargs):
        
        mqttc = mqtt.Client()
        mqttc.connect(
            command['host'],
            port=int(command['port']))

        mqttc.loop_start()

        try:
            mqttc.publish(
                command['endpoint'],
                command['payload'])
        finally:
            mqttc.loop_stop(force=False)
1173658
public function fire(Command $command)
    {
        $this->command = $command;

        $connected = false;

        while (! $connected) {
            $host = $this->askDatabaseHost();

            $name = $this->askDatabaseName();

            $user = $this->askDatabaseUsername();

            $password = $this->askDatabasePassword();

            $this->setLaravelConfiguration($name, $user, $password, $host);

            if ($this->databaseConnectionIsValid()) {
                $connected = true;
            } else {
                $command->error('Please ensure your database credentials are valid.');
            }
        }

        $this->env->write($name, $user, $password, $host);

        $command->info('Database successfully configured');
    }
1086162
public function execute(Command $command)
    {
        if ($this->locked === true) {
            $this->queue[] = $command;
            return null;
        }

        $this->locked = true;

        $response = $this->executeIgnoringLock($command);

        $this->executeQueue();

        $this->locked = false;

        return $response;
    }
1288403
protected function runCustomCommand($command)
    {
        if (!CommandRegistry::hasCommand($command['command'])) {
            throw new BadMethodCallException('Command "' . $command['command'] . '" not found');
        }
        $customCommand = CommandRegistry::getCommand($command['command']);
        
        array_unshift($command['params'], $this->image);
        call_user_func_array($customCommand, $command['params']);
        
        return true;
    }
626308
public function dispatch($command)
    {
        if (! is_null($this->queueResolver) && $this->commandShouldBeQueued($command)) {
            return $this->dispatchToQueue($command);
        } else {
            return $this->dispatchNow($command);
        }
    }
1333324
private function runRemote($command) {
		// make commands a list
		if (!is_array($command))
			$command = array($command);
		$command = strval(implode(';', $command));
		
		return $this->runLocal(['plink',
					'-ssh',					// interacting method
					'-i', static::safeDir($this->ppk),		// Private key file to access server
					$this->host,			// username and hostname to connect to
			
					'"' . $command . '"',	// Commands to run
		]);
	}