public function startTask(TaskInterface $task)
    {
        $response = $this->http->post($this->getTaskWorkerUrl(), [
            self::ATTR_PROG => self::PROG,
            self::ATTR_NAME => get_class($task),
            self::ATTR_DATA => $this->serializer->encode($this->properties->getPropertiesFromObject($task)),
            self::ATTR_MAX_PROCESSING_TIME => method_exists($task, 'getMaxProcessingTime') ? $task->getMaxProcessingTime() : null,
        ]);

        if ($response->hasErrors()) {
            if (strpos($response->body->error, 'Your worker does not listen') !== false) {
                throw new AgentNotListeningException($this->appId, $this->appEnv);
            }

            if (strpos($response->body->error, 'Unknown version') !== false) {
                throw new AgentUpdateRequiredException('>=0.6.0');
            }

            throw new AgentException($response->body->error);
        }
    }
public function startTask(TaskInterface $task)
    {
        $response = $this->http->post($this->getTaskWorkerUrl(), [
            self::ATTR_PROG => self::PROG,
            self::ATTR_NAME => get_class($task),
            self::ATTR_DATA => $this->serializer->encode($this->properties->getPropertiesFromObject($task)),
            self::ATTR_MAX_PROCESSING_TIME => method_exists($task, 'getMaxProcessingTime') ? $task->getMaxProcessingTime() : null,
        ]);

        if ($response->hasErrors()) {
            if (strpos($response->body->error, 'Your worker does not listen') !== false) {
                throw new AgentNotListeningException($this->appId, $this->appEnv);
            }

            if (strpos($response->body->error, 'Unknown version') !== false) {
                throw new AgentUpdateRequiredException('>=0.6.0');
            }

            throw new AgentException($response->body->error);
        }
    }
public function startTask ( TaskInterface $ task ) { $ response = $ this -> http -> post ( $ this -> getTaskWorkerUrl ( ) , [ self :: ATTR_PROG => self :: PROG , self :: ATTR_NAME => get_class ( $ task ) , self :: ATTR_DATA => $ this -> serializer -> encode ( $ this -> properties -> getPropertiesFromObject ( $ task ) ) , self :: ATTR_MAX_PROCESSING_TIME => method_exists ( $ task , 'getMaxProcessingTime' ) ? $ task -> getMaxProcessingTime ( ) : null , ] ) ; if ( $ response -> hasErrors ( ) ) { if ( strpos ( $ response -> body -> error , 'Your worker does not listen' ) !== false ) { throw new AgentNotListeningException ( $ this -> appId , $ this -> appEnv ) ; } if ( strpos ( $ response -> body -> error , 'Unknown version' ) !== false ) { throw new AgentUpdateRequiredException ( '>=0.6.0' ) ; } throw new AgentException ( $ response -> body -> error ) ; } }
Start a single task.

@throws AgentNotListeningException   If the agent is not listening to the application
@throws AgentUpdateRequiredException If the agent does not have the minimum required version
@throws AgentException               For any other error coming from the agent
Start a single task .