I have written a MessagePostProcessor which gets called before any consumer onMessage is called.
Now if any exception occurs in my MessagePostProcessor i need to catch the exception otherwise the message will get infinitely requed in Rabbitmq server Q getting back to and fro again. So fix this problem i need to catch an exception in my component MessagePostProcessor , But because of that the consumers are not getting correct problem for the issue at their end.
What is best practice of handling such scenarios.
Pseudo MessagePostProcessor
@Service
public class TestPostProcessor implements MessagePostProcessor {
/**
* {@inheritDoc}
*/
@Override
public Message postProcessMessage(Message message) {
try {
// some logic
} catch (Exception exception) {
// log error
}
return message;
}
}