2017 © Pedro Peláez
 

library queue-repeat

image

avtonom/queue-repeat

  • Tuesday, March 20, 2018
  • by avtonomspb
  • Repository
  • 1 Watchers
  • 1 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

queue-repeat

Queue Repeat Manager to RabbitMQ., (*1)

Page bundle: https://github.com/Avtonom/queue-repeat, (*2)

if you use symfony https://github.com/Avtonom/delay-exponential-backoff-bundle, (*3)

Use delay Exponential expression, (*4)

install, (*5)

    $ composer require "avtonom/queue-repeat"

Use simple:, (*6)

    /** \PhpAmqpLib\Message\AMQPMessage $msg **/
    $messageHeaders = ($message->has('application_headers')) ? $msg->get('application_headers')->getNativeData() : new AMQPTable();
    $connection = $container->get('@old_sound_rabbit_mq.connection.default');

    $repeatManager = new QueueRepeat\QueueRepeatManager();
    $repeatManager->init($connection->channel(), $queue, $exchange);
    $cap = 1 * 1000000;
    $retryMax = 5;
    try {
        /**
         * @param array $messageHeaders
         * @param string $routingKey
         * @param array $data
         * @param int $retryMax - 5 then it will be retried if the job processing fails
         * @param int $cap - 1000000 milliseconds. The value of the TTL argument or policy must be a non-negative integer (0 <= n), describing the TTL period in milliseconds. Thus a value of 1000 means that a message added to the queue will live in the queue for 1 second or until it is delivered to a consumer. The retryDelay option allows you to progressively delay the job processing on successive retries.
         */
        $repeatManager->resendMessage($messageHeaders, $routingKey, $data, $retryMax, $cap);
    } catch (QueueRepeatException $e) { }

Use full code:, (*7)

config, (*8)

    /** \PhpAmqpLib\Message\AMQPMessage $msg **/
    $messageHeaders = ($message->has('application_headers')) ? $msg->get('application_headers')->getNativeData() : new AMQPTable();

QueueProvider, (*9)

    /**
     * @return QueueRepeatManager
     */
    public function getRepeatManager()
    {
        return $this->repeatManager;
    }

    /**
     * @param QueueRepeatManager $repeatManager
     */
    public function setRepeatManager($repeatManager)
    {
        $repeatManager->init($this->channel, $this->queue, $this->exchange);
        $this->repeatManager = $repeatManager;
    }

use, (*10)

    /**
     * @param array $messageHeaders
     * @param string $routingKey
     * @param array $data
     * @param int $retryMax - 5 then it will be retried if the job processing fails
     * @param int $cap - 1000000 milliseconds. The value of the TTL argument or policy must be a non-negative integer (0 <= n), describing the TTL period in milliseconds. Thus a value of 1000 means that a message added to the queue will live in the queue for 1 second or until it is delivered to a consumer. The retryDelay option allows you to progressively delay the job processing on successive retries.
     */
    $this->getQueueProvider()->setRepeatManager(new QueueRepeatManager());
    try {
        $this->getQueueProvider()->getRepeatManager()->resendMessage($messageHeaders, $routingKey, $data, $retryMax, $cap);
    } catch (QueueRepeatException $e) {
        $this->getLogger()->warning('QueueRepeatException: '. $e->getMessage());
    }

Read information https://habrahabr.ru/post/227225/, (*11)

The Versions

20/03 2018

dev-master

9999999-dev https://github.com/Avtonom/queue-repeat

  Sources   Download

MIT

The Requires

 

by Anton U

rabbitmq queue amqp retry delay repeat amqplib queue-repeat

20/03 2018

v0.1.5

0.1.5.0 https://github.com/Avtonom/queue-repeat

  Sources   Download

MIT

The Requires

 

by Anton U

rabbitmq queue amqp retry delay repeat amqplib queue-repeat

19/03 2018

v0.1.4

0.1.4.0 https://github.com/Avtonom/queue-repeat

  Sources   Download

MIT

The Requires

 

by Anton U

rabbitmq queue amqp retry delay repeat amqplib queue-repeat

14/11 2017

v0.1.3

0.1.3.0 https://github.com/Avtonom/queue-repeat

  Sources   Download

MIT

The Requires

 

by Anton U

rabbitmq queue amqp retry delay repeat amqplib queue-repeat

13/11 2017

v0.1.2

0.1.2.0 https://github.com/Avtonom/queue-repeat

  Sources   Download

MIT

The Requires

 

by Anton U

rabbitmq queue amqp retry delay repeat amqplib queue-repeat

13/11 2017

v0.1.1

0.1.1.0 https://github.com/Avtonom/queue-repeat

  Sources   Download

MIT

The Requires

 

by Anton U

rabbitmq queue amqp retry delay repeat amqplib queue-repeat

10/11 2017

v0.1.0

0.1.0.0 https://github.com/Avtonom/queue-repeat

  Sources   Download

MIT

The Requires

 

by Anton U

rabbitmq queue amqp retry delay repeat amqplib queue-repeat