public function processParallel()
    {
        if (
            !$this->campaign
            || !$this->contact
            || !$this->contact->getId()
        ) {
            return $this;
        }

        if (
            $this->realTime
            && !boolval($this->getIntegrationSetting('parallel_realtime', false))
        ) {
            $this->logger->debug('Parallel processing disabled for realtime.');

            return $this;
        }

        if (
            !$this->realTime
            && !boolval($this->getIntegrationSetting('parallel_offline', false))
        ) {
            $this->logger->debug('Parallel processing disabled for non-realtime.');

            return $this;
        }

        if (
            $this->imported
            && !boolval($this->getIntegrationSetting('parallel_import', false))
        ) {
            $this->logger->debug('Parallel processing disabled for imports.');

            return $this;
        }

        // Update the list of campaigns for this contact, and get a list of those that need to be processed.
        $campaignsFound = false;
        foreach (array_keys($this->campaignModel->getLeadCampaigns($this->contact, true)) as $campaignId) {
            if (!isset($this->contactCampaigns[$campaignId])) {
                $this->contactCampaigns[$campaignId] = false;
                $campaignsFound                      = true;
            }
        }
        if (!$campaignsFound) {
            $this->logger->debug('No campaigns to process in parallel');

            return $this;
        }

        return $this->kickoffParallelCampaigns($this->contact, $this->contactCampaigns, !$this->imported);
    }
public function processParallel()
    {
        if (
            !$this->campaign
            || !$this->contact
            || !$this->contact->getId()
        ) {
            return $this;
        }

        if (
            $this->realTime
            && !boolval($this->getIntegrationSetting('parallel_realtime', false))
        ) {
            $this->logger->debug('Parallel processing disabled for realtime.');

            return $this;
        }

        if (
            !$this->realTime
            && !boolval($this->getIntegrationSetting('parallel_offline', false))
        ) {
            $this->logger->debug('Parallel processing disabled for non-realtime.');

            return $this;
        }

        if (
            $this->imported
            && !boolval($this->getIntegrationSetting('parallel_import', false))
        ) {
            $this->logger->debug('Parallel processing disabled for imports.');

            return $this;
        }

        // Update the list of campaigns for this contact, and get a list of those that need to be processed.
        $campaignsFound = false;
        foreach (array_keys($this->campaignModel->getLeadCampaigns($this->contact, true)) as $campaignId) {
            if (!isset($this->contactCampaigns[$campaignId])) {
                $this->contactCampaigns[$campaignId] = false;
                $campaignsFound                      = true;
            }
        }
        if (!$campaignsFound) {
            $this->logger->debug('No campaigns to process in parallel');

            return $this;
        }

        return $this->kickoffParallelCampaigns($this->contact, $this->contactCampaigns, !$this->imported);
    }
public function processParallel ( ) { if ( ! $ this -> campaign || ! $ this -> contact || ! $ this -> contact -> getId ( ) ) { return $ this ; } if ( $ this -> realTime && ! boolval ( $ this -> getIntegrationSetting ( 'parallel_realtime' , false ) ) ) { $ this -> logger -> debug ( 'Parallel processing disabled for realtime.' ) ; return $ this ; } if ( ! $ this -> realTime && ! boolval ( $ this -> getIntegrationSetting ( 'parallel_offline' , false ) ) ) { $ this -> logger -> debug ( 'Parallel processing disabled for non-realtime.' ) ; return $ this ; } if ( $ this -> imported && ! boolval ( $ this -> getIntegrationSetting ( 'parallel_import' , false ) ) ) { $ this -> logger -> debug ( 'Parallel processing disabled for imports.' ) ; return $ this ; } // Update the list of campaigns for this contact, and get a list of those that need to be processed. $ campaignsFound = false ; foreach ( array_keys ( $ this -> campaignModel -> getLeadCampaigns ( $ this -> contact , true ) ) as $ campaignId ) { if ( ! isset ( $ this -> contactCampaigns [ $ campaignId ] ) ) { $ this -> contactCampaigns [ $ campaignId ] = false ; $ campaignsFound = true ; } } if ( ! $ campaignsFound ) { $ this -> logger -> debug ( 'No campaigns to process in parallel' ) ; return $ this ; } return $ this -> kickoffParallelCampaigns ( $ this -> contact , $ this -> contactCampaigns , ! $ this -> imported ) ; }
Attempt to run kickoff events for a single contact in a parallel process if possible, otherwise synchronously.

@return $this|Api

@throws \Doctrine\DBAL\ConnectionException
@throws \Mautic\CampaignBundle\Executioner\Dispatcher\Exception\LogNotProcessedException
@throws \Mautic\CampaignBundle\Executioner\Dispatcher\Exception\LogPassedAndFailedException
@throws \Mautic\CampaignBundle\Executioner\Exception\CannotProcessEventException
@throws \Mautic\CampaignBundle\Executioner\Scheduler\Exception\NotSchedulableException
Attempt to run kickoff events for a single contact in a parallel process if possible otherwise synchronously .