The recent spring-amqp 1.1.0 release introduced a new attribute on the listener-container...
Code:
<xsd:attribute name="requeue-rejected" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
Tells the container the default requeue behavior when rejecting messages. Default is 'true' meaning messages
will be requeued, unless the listener signals not to by throwing an AmqpRejectAndDontRequeueException. When
set to false, messages will never be requeued.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="phase" type="xsd:string">
As noted in the schema docs, if you want to do it selectively, you can leave it as the default (true) and throw an AmqpRejectAndDontRequeueException (or set it as the cause of the MessageConversionException) from your custom message converter.
This was intended to facilitate delivery to a Dead Letter Exchange, but it will also work when no DLE is defined.
You will have to generate and send the error message from within your converter, perhaps by delegating to some custom error handler there.
Gary P. Russell
Spring Integration Team
SpringSource, a division of VMware