I have a camel route defined roughly as follows:
from("aws-sqs://my-queue")
.process(myProcessor)
.to(myEndpoint);
However, myProcessor relies on an upstream service that sometimes becomes unavailable or returns a "pending" response, so the processor throws an exception and the exchange is left on the queue. Camel then polls and fails successively until the message is DLQed.
What I would like to do is configure visibilityTimeout dynamically to implement an exponential back-off until the upstream service is available again. So instead of from("aws-sqs://my-queue?visibilityTimeout=30"), I would register an exception handler in my route and inside of it, do something like:
sqsClient.setVisibilityTimeout(Math.pow(2 * visibilityTimeout));
Is this possible? And as a bonus, is it possible to configure the visibility timeout for a specific message id (eg. so it doesn't affect the visibility timeout of other messages)?