protected function createRetryMessage(EnvelopeInterface $envelope, $attempt, \Exception $exception = null)
    {
        $headers = $envelope->getHeaders();
        $headers[RetryProcessor::PROPERTY_KEY] = $attempt;

        if ($exception) {
            $headers['x-exception'] = [
                'message' => $exception->getMessage(),
                'type' => get_class($exception),
                'file' => $exception->getFile(),
                'line' => $exception->getLine(),
            ];
        }

        $properties = new MessageProperties([
            MessageProperties::KEY_CONTENT_TYPE => $envelope->getContentType(),
            MessageProperties::KEY_DELIVERY_MODE => $envelope->getDeliveryMode(),
            MessageProperties::KEY_HEADERS => $headers,
            MessageProperties::KEY_PRIORITY => $envelope->getPriority(),
        ]);

        return new Message(
            $envelope->getBody(),
            $properties,
            $envelope->getDeliveryTag(),
            $envelope->getRoutingKey()
        );
    }
protected function createRetryMessage(EnvelopeInterface $envelope, $attempt, \Exception $exception = null)
    {
        $headers = $envelope->getHeaders();
        $headers[RetryProcessor::PROPERTY_KEY] = $attempt;

        if ($exception) {
            $headers['x-exception'] = [
                'message' => $exception->getMessage(),
                'type' => get_class($exception),
                'file' => $exception->getFile(),
                'line' => $exception->getLine(),
            ];
        }

        $properties = new MessageProperties([
            MessageProperties::KEY_CONTENT_TYPE => $envelope->getContentType(),
            MessageProperties::KEY_DELIVERY_MODE => $envelope->getDeliveryMode(),
            MessageProperties::KEY_HEADERS => $headers,
            MessageProperties::KEY_PRIORITY => $envelope->getPriority(),
        ]);

        return new Message(
            $envelope->getBody(),
            $properties,
            $envelope->getDeliveryTag(),
            $envelope->getRoutingKey()
        );
    }
protected function createRetryMessage ( EnvelopeInterface $ envelope , $ attempt , \ Exception $ exception = null ) { $ headers = $ envelope -> getHeaders ( ) ; $ headers [ RetryProcessor :: PROPERTY_KEY ] = $ attempt ; if ( $ exception ) { $ headers [ 'x-exception' ] = [ 'message' => $ exception -> getMessage ( ) , 'type' => get_class ( $ exception ) , 'file' => $ exception -> getFile ( ) , 'line' => $ exception -> getLine ( ) , ] ; } $ properties = new MessageProperties ( [ MessageProperties :: KEY_CONTENT_TYPE => $ envelope -> getContentType ( ) , MessageProperties :: KEY_DELIVERY_MODE => $ envelope -> getDeliveryMode ( ) , MessageProperties :: KEY_HEADERS => $ headers , MessageProperties :: KEY_PRIORITY => $ envelope -> getPriority ( ) , ] ) ; return new Message ( $ envelope -> getBody ( ) , $ properties , $ envelope -> getDeliveryTag ( ) , $ envelope -> getRoutingKey ( ) ) ; }
Creates a new message to retry.

@param EnvelopeInterface $envelope
@param int               $attempt
@param \Exception        $exception

@return Message
Creates a new message to retry .