roger v1.4.1 Roger.Partition.Retry View Source

Implements the retry logic for jobs.

Jobs are retried at a fixed number of delay intervals. By default, these are the following (in seconds):

1, 3, 5, 10, 20, 35, 60, 100, 200, 400, 1000, 1800.

To override these levels, set the following configuration:

config :roger,
  retry_levels: [1, 10, 60]

This sets 3 retry levels, the first time is a job retried after 1 second, then after 10 seconds and finally after 60.

Implementation

For every retry level, a separate AMQP queue is made. The messages in the queue have a TTL value that is set to the retry delay. After the TTL expires, the messages are sent to the “dead letter exchange”, which for this queue points to the original queue.

The queues themselves also have an expiry so that when the queue is empty, it will be removed.

Link to this section Summary

Functions

Given an AMQP channel and the partition, queues the given job for retry

Link to this section Functions

Link to this function retry(channel, partition, job) View Source

Given an AMQP channel and the partition, queues the given job for retry.