src/Worker.php
function performPayload(iPayloadQueued $processPayload)
    {
        $triesCount = 0;

        if ($processPayload instanceof FailedPayload) {
            if ( $processPayload->getCountRetries() > $this->getMaxTries() )
                throw new exPayloadMaxTriesExceed(
                    $processPayload
                    , sprintf('Max Tries Exceeds After %s Tries.', $processPayload->getCountRetries())
                    , null
                );
        }


        $payLoadData = $processPayload->getData();


        try {

            if ( ob_get_level() )
                ## clean output buffer, display just error page
                ob_end_clean();
            ob_start();

            $this->event()->trigger(
                EventHeapOfWorker::EVENT_PAYLOAD_RECEIVED
                , [ 'payload' => $processPayload, 'data' => $payLoadData, 'worker' => $this ]
            );

            ob_end_flush(); // Strange behaviour, will not work
            flush();        // Unless both are called !

        } catch (\LogicException $e) {
            // Exception is logical and its ok to throw
            throw $e;

        } catch (\Exception $e) {
            // Process Failed
            // Notify Main Stream
            if (! $processPayload instanceof FailedPayload)
                $failedPayload = new FailedPayload($processPayload, $triesCount);
            else
                $failedPayload = $processPayload;


            throw new exPayloadPerformFailed($failedPayload, $e);
        }
    }
function performPayload(iPayloadQueued $processPayload)
    {
        $triesCount = 0;

        if ($processPayload instanceof FailedPayload) {
            if ( $processPayload->getCountRetries() > $this->getMaxTries() )
                throw new exPayloadMaxTriesExceed(
                    $processPayload
                    , sprintf('Max Tries Exceeds After %s Tries.', $processPayload->getCountRetries())
                    , null
                );
        }


        $payLoadData = $processPayload->getData();


        try {

            if ( ob_get_level() )
                ## clean output buffer, display just error page
                ob_end_clean();
            ob_start();

            $this->event()->trigger(
                EventHeapOfWorker::EVENT_PAYLOAD_RECEIVED
                , [ 'payload' => $processPayload, 'data' => $payLoadData, 'worker' => $this ]
            );

            ob_end_flush(); // Strange behaviour, will not work
            flush();        // Unless both are called !

        } catch (\LogicException $e) {
            // Exception is logical and its ok to throw
            throw $e;

        } catch (\Exception $e) {
            // Process Failed
            // Notify Main Stream
            if (! $processPayload instanceof FailedPayload)
                $failedPayload = new FailedPayload($processPayload, $triesCount);
            else
                $failedPayload = $processPayload;


            throw new exPayloadPerformFailed($failedPayload, $e);
        }
    }
function performPayload ( iPayloadQueued $ processPayload ) { $ triesCount = 0 ; if ( $ processPayload instanceof FailedPayload ) { if ( $ processPayload -> getCountRetries ( ) > $ this -> getMaxTries ( ) ) throw new exPayloadMaxTriesExceed ( $ processPayload , sprintf ( 'Max Tries Exceeds After %s Tries.' , $ processPayload -> getCountRetries ( ) ) , null ) ; } $ payLoadData = $ processPayload -> getData ( ) ; try { if ( ob_get_level ( ) ) ## clean output buffer, display just error page ob_end_clean ( ) ; ob_start ( ) ; $ this -> event ( ) -> trigger ( EventHeapOfWorker :: EVENT_PAYLOAD_RECEIVED , [ 'payload' => $ processPayload , 'data' => $ payLoadData , 'worker' => $ this ] ) ; ob_end_flush ( ) ; // Strange behaviour, will not work flush ( ) ; // Unless both are called ! } catch ( \ LogicException $ e ) { // Exception is logical and its ok to throw throw $ e ; } catch ( \ Exception $ e ) { // Process Failed // Notify Main Stream if ( ! $ processPayload instanceof FailedPayload ) $ failedPayload = new FailedPayload ( $ processPayload , $ triesCount ) ; else $ failedPayload = $ processPayload ; throw new exPayloadPerformFailed ( $ failedPayload , $ e ) ; } }
Perform Payload Execution

@param iPayloadQueued $processPayload

@return void
Perform Payload Execution