Setup:
- We have a Spring Boot application that is reading messages from an ActiveMQ Artemis JMS queue.
- The messages are processing in a JPA transaction.
- When there is an exception triggering a rollback in JPA, it also triggers a JMS rollback in Artemis that is setup with redelivery delay.
- Our app is running in multiple instances in parallel and this cause optimistic locking issues when processing multiple messages that share common data.
Issue: When X messages are processed in parallel and there is optimistic locking issue, then only 1 message goes through and all the others are re-scheduled with the delay. When redelivery happens, then same as before the X-1 messages will arrive at the same time since the delay is the same and cause the same issue with only one going through.
Question: Does anyone know a way to add variance to the redelivery delay time of ActiveMQ Artemis?
Note: I know that there is an option for that in ActiveMQ 5.x called collisionAvoidanceFactor, but it is missing from ActiveMQ Artemis.