Validating package payload ideneb
Instead, it becomes a ‘poison pill’ which causes this pathological behavior.After a little digging in the Spring-AMQP sources, I found that you remedy this relatively easily: the Simple Rabbit Listener Container Factory (which is the only supplied implementation of a Rabbit Listener Container Factory) creates a Simple Message Listener Container with a default Error Handler of type Conditional Rejecting Error Handler.Therefore, you need to implement your own Fatal Exception Strategy that considers that root exception as fatal too.Here’s how you can implement and configure that in your configuration class:@Bean Simple Rabbit Listener Container Factory rabbit Listener Container Factory(Connection Factory connection Factory) /** * Extension of Spring-AMQP's * * which also considers a root cause of * (thrown when payload does not validate) as fatal.You want to achieve this with some shiny extendable annotations?Then give the Java Bean Validation standard aka JSR-303 a try..
Illegal Argument Exception: A Servlet Context is required to configure default servlet handling at org.springframework.beans.factory.support. Illegal Argument Exception: A Servlet Context is required to configure default servlet handling at org. I’m not even going to try to understand the details of that; Spring initialization in Boot is a rather complicated and obviously sometimes also brittle process, so to err on the safe side I simply added a dedicated Validator for Spring-AMQP like this: WARN 22764 --- [c Task Executor-1] s.a.r.l. 12 common frames omitted WARN 22764 --- [c Task Executor-1] s.a.r.l. 12 common frames omitted WARN 22764 --- [c Task Executor-1] s.a.r.l. 12 common frames omitted What you see here is that when the message is received and the validation fails, the message is rejected and put back on the queue.
Once you provide these information, this module will check the structure of JSON Object against the target one. if key in payload expects the number and incoming payload contains string value.