src/SA/CpeSdk/CpeActivity.php
public function activityHeartbeat($data = null)
    {
        $context = [
            'taskToken' => $this->token
        ];

        try {
            $this->cpeLogger->logOut("INFO", basename(__FILE__),
                                     "\033[1mSending heartbeat to Sfn ...\033[0m",
                                     $this->logKey);

            $this->cpeSfnHandler->sfn->sendTaskHeartbeat($context);

            // Notify the client if any
            if ($this->client)
                $this->client->onHeartbeat($this->token, $data);

        } catch (\Exception $e) {
            $this->cpeLogger->logOut("ERROR", basename(__FILE__),
                                     "Unable to send 'Task Heartbeat' to Sfn! " . $e->getMessage(),
                                     $this->logKey);

            // Notify the client if any
            if ($this->client)
                $this->client->onException($context, $e);

            return false;
        }

        return true;
    }
public function activityHeartbeat($data = null)
    {
        $context = [
            'taskToken' => $this->token
        ];

        try {
            $this->cpeLogger->logOut("INFO", basename(__FILE__),
                                     "\033[1mSending heartbeat to Sfn ...\033[0m",
                                     $this->logKey);

            $this->cpeSfnHandler->sfn->sendTaskHeartbeat($context);

            // Notify the client if any
            if ($this->client)
                $this->client->onHeartbeat($this->token, $data);

        } catch (\Exception $e) {
            $this->cpeLogger->logOut("ERROR", basename(__FILE__),
                                     "Unable to send 'Task Heartbeat' to Sfn! " . $e->getMessage(),
                                     $this->logKey);

            // Notify the client if any
            if ($this->client)
                $this->client->onException($context, $e);

            return false;
        }

        return true;
    }
public function activityHeartbeat ( $ data = null ) { $ context = [ 'taskToken' => $ this -> token ] ; try { $ this -> cpeLogger -> logOut ( "INFO" , basename ( __FILE__ ) , "\033[1mSending heartbeat to Sfn ...\033[0m" , $ this -> logKey ) ; $ this -> cpeSfnHandler -> sfn -> sendTaskHeartbeat ( $ context ) ; // Notify the client if any if ( $ this -> client ) $ this -> client -> onHeartbeat ( $ this -> token , $ data ) ; } catch ( \ Exception $ e ) { $ this -> cpeLogger -> logOut ( "ERROR" , basename ( __FILE__ ) , "Unable to send 'Task Heartbeat' to Sfn! " . $ e -> getMessage ( ) , $ this -> logKey ) ; // Notify the client if any if ( $ this -> client ) $ this -> client -> onException ( $ context , $ e ) ; return false ; } return true ; }
Send heartbeat to Sfn to keep the task alive.
Call this from your activity logic. If return false then the heartbeat was not sent
Try again or throw an exception to mark the Activity as failed
Send heartbeat to Sfn to keep the task alive . Call this from your activity logic . If return false then the heartbeat was not sent Try again or throw an exception to mark the Activity as failed