0

I need to fetch the max retries from the retry strategy of the queue, where my message is processed. If I have an example configuration:

framework:
  messenger:
   default_bus: messenger.bus.default

transports:
  async:
    dsn: '%env(DNS)%'
    retry_strategy:
      max_retries: 5
      delay: 10000
      multiplier: 3
      max_delay: 3600000
routing:
  'App\Message\MyMessage': async

and now I have a custom middleware:

class RetryCountMiddleware implements MiddlewareInterface
{
    public function handle(Envelope $envelope, StackInterface $stack): Envelope
    {
        // get here the max_retries = 5 ??

        return $stack->next()->handle($envelope, $stack);
    }
}
Mutatos
  • 1,675
  • 4
  • 25
  • 55

0 Answers0