Home > Blockchain >  How to perform arithmentic operation in delayExpression in @Backoff (Spring-retry)
How to perform arithmentic operation in delayExpression in @Backoff (Spring-retry)

Time:07-09

I want to take delay time in minutes from ENV variable. How to convert minutes into ms in expression string?

@Backoff(delayExpression = "${delay_in_minutes:2} * 60 * 1000",
         maxDelayExpression = "${max_delay_in_minutes:10} * 60 * 1000",
         multiplierExpression = "${multiplier:2.0}")

CodePudding user response:

Use SEPL(Spring expression language) like below:

@Backoff(delayExpression = "#{${delay_in_minutes:2} * 60 * 1000}",
         maxDelayExpression = "#{${max_delay_in_minutes:10} * 60 * 1000}",
         multiplierExpression = "${multiplier:2.0}")
  • Related