public function start_job($client, $input, $jobId = null)
    {
        $decodedClient = is_object($client) ? $client : json_decode($client);
        $decodedInput = is_object($input) ? $input : json_decode($input);

        if (!$decodedClient) {
            throw new \InvalidArgumentException(
                "Invalid JSON 'client' to start new job!");
        }
        if (!$decodedInput) {
            throw new \InvalidArgumentException(
                "Invalid JSON 'input' to start new job!");
        }

        $this->validate_client($decodedClient);

        $jobId = $jobId ?: md5($decodedClient->{'name'} . uniqid('',true));
        $msg = $this->craft_new_msg(
            self::START_JOB,
            $jobId,
            $decodedClient,
            $decodedInput
        );

        $this->sqs->sendMessage(array(
                'QueueUrl'    => $decodedClient->{'queues'}->{'input'},
                'MessageBody' => json_encode($msg),
            ));

        return ($jobId);
    }
public function start_job($client, $input, $jobId = null)
    {
        $decodedClient = is_object($client) ? $client : json_decode($client);
        $decodedInput = is_object($input) ? $input : json_decode($input);

        if (!$decodedClient) {
            throw new \InvalidArgumentException(
                "Invalid JSON 'client' to start new job!");
        }
        if (!$decodedInput) {
            throw new \InvalidArgumentException(
                "Invalid JSON 'input' to start new job!");
        }

        $this->validate_client($decodedClient);

        $jobId = $jobId ?: md5($decodedClient->{'name'} . uniqid('',true));
        $msg = $this->craft_new_msg(
            self::START_JOB,
            $jobId,
            $decodedClient,
            $decodedInput
        );

        $this->sqs->sendMessage(array(
                'QueueUrl'    => $decodedClient->{'queues'}->{'input'},
                'MessageBody' => json_encode($msg),
            ));

        return ($jobId);
    }
public function start_job ( $ client , $ input , $ jobId = null ) { $ decodedClient = is_object ( $ client ) ? $ client : json_decode ( $ client ) ; $ decodedInput = is_object ( $ input ) ? $ input : json_decode ( $ input ) ; if ( ! $ decodedClient ) { throw new \ InvalidArgumentException ( "Invalid JSON 'client' to start new job!" ) ; } if ( ! $ decodedInput ) { throw new \ InvalidArgumentException ( "Invalid JSON 'input' to start new job!" ) ; } $ this -> validate_client ( $ decodedClient ) ; $ jobId = $ jobId ? : md5 ( $ decodedClient -> { 'name' } . uniqid ( '' , true ) ) ; $ msg = $ this -> craft_new_msg ( self :: START_JOB , $ jobId , $ decodedClient , $ decodedInput ) ; $ this -> sqs -> sendMessage ( array ( 'QueueUrl' => $ decodedClient -> { 'queues' } -> { 'input' } , 'MessageBody' => json_encode ( $ msg ) , ) ) ; return ( $ jobId ) ; }
Send a `start_job` command to CPE

Call this method from your client application to start a new job.
You can pass an object or a JSON string as input payload.
You can also specify your own jobId, or it will generate it for you.

@param string|object $client JSON string or PHP Object created using json_decode. This contains your client SQS configuration which list your application `input` and `output` queues.
@param object|string $input The data payload to be sent out to CPE. This will be used
as input for your workflow.
@param string|null $jobId JobID for your new job. Will be generated for you if not provided.

@return string Return the JobIb for the job. Can throw execeptions if it fails. Use try catch.
Send a start_job command to CPE