Skip to content

PcComponentes/messenger-retry-bundle

Repository files navigation

Symfony Bundle for retry policy in Symfony Messenger

This is a Bundle to add the ability to choose the retry policy based on the type of message you are trying to process.

Note: Messages should ultimately inherit from Message.

Installation

  1. Install via composer

    composer require pccomponentes/messenger-retry-bundle
  2. Write the bundle configuration file (config/packages/messenger_retry.yaml) indicating the retry policies for each message class and the action you want to execute in each of them. An example of its content is:

    messenger_retry:
      - max_retries: 5
        delay_milliseconds: 2000
        multiplier: 2
        max_delay_milliseconds: 2800000
        msg_types:  
          - PcComponentes\Ddd\Application\Command: auto
        # - PcComponentes\Ddd\Application\Command: always_retry
        # - PcComponentes\Ddd\Application\Command: never_retry

    This file will be modified to add or remove any retry policies needed for the project it is used in.