Sending acknowledgment to rabbitmq server in depends on converter and listener

前端 未结 1 762
走了就别回头了
走了就别回头了 2021-01-28 01:52

First of all, I present context of my case:
I am using spring-boot and spring-rabbitmq. It is working for me, you should know that I must have imp

相关标签:
1条回答
  • 2021-01-28 02:21

    Please read the reference manual.

    The behavior is (mostly) controlled by the ErrorHandler.

    Throw a MessageConversionException - the container requeues messages for most exceptions but some exceptions are considered fatal. Generally, if a message can't be converted, then redelivering it makes no sense.

    This is all clearly explained in the section (surprisingly?) called Exception Handling

    Starting with version 1.3.2, the default ErrorHandler is now a ConditionalRejectingErrorHandler which will reject (and not requeue) messages that fail with an irrecoverable error:

    o.s.amqp...MessageConversionException

    o.s.messaging...MessageConversionException

    o.s.messaging...MethodArgumentNotValidException

    o.s.messaging...MethodArgumentTypeMismatchException

    java.lang.NoSuchMethodException

    java.lang.ClassCastException

    The first can be thrown when converting the incoming message payload using a MessageConverter. The second may be thrown by the conversion service if additional conversion is required when mapping to a @RabbitListener method. The third may be thrown if validation (e.g. @Valid) is used in the listener and the validation fails. The fourth may be thrown if the inbound message was converted to a type that is not correct for the target method. For example, the parameter is declared as Message but Message is received.

    The fifth and sixth were added in version 1.6.3.

    You can customize the ErrorHandler as needed.

    0 讨论(0)
提交回复
热议问题