protected function doPop()
    {
        // ensures that the SQS Queue exist
        if (!$this->queueExists()) {
            $this->createQueue();
        }

        $logContext = [
            'QueueUrl' => $this->queueUrl
        ];

        try {
            $result = $this->getClient()->receiveMessage([
                'AttributeNames' => [], //nothing
                'MaxNumberOfMessages' => $this->getNumberOfTasksToReceive(),
                'MessageAttributeNames' => [], //nothing
                'QueueUrl' => $this->queueUrl,
                'WaitTimeSeconds' => 20 //retrieving messages with Long Polling
            ]);

            if (count($result->get('Messages')) > 0) {
                $this->logDebug('Received '. count($result->get('Messages')) .' messages.', $logContext);

                foreach ($result->get('Messages') as $message) {
                    $task = $this->unserializeTask($message['Body'], $message['ReceiptHandle'], [
                        'SqsMessageId' => $message['MessageId']
                    ]);

                    if ($task) {
                        $task->setMetadata('SqsMessageId', $message['MessageId']);
                        $task->setMetadata('ReceiptHandle', $message['ReceiptHandle']);
                        $this->pushPreFetchedMessage($task);
                    }
                }
            } else {
                $this->logDebug('No messages in queue.', $logContext);
            }
        } catch (AwsException $e) {
            $this->logError('Popping tasks failed with MSG: '. $e->getAwsErrorMessage(), $logContext);
        }
    }