Hi
In case anyone is following this thread I managed to make messages NON_PERSISTENT by passing the message through a Spring Integration header enricher to add the header 'ampq_deliveryMode' withe value MessageDeliveryMode.NON_PERSISTENT.
This is an enum value and did cause me problems setting it from the context xml, in the end I got round this by using a bean to return the enum value.
I used the context xml to create the enricher and specified the header field and bean method to use for the value.
Code:
<int:header-enricher input-channel="nonPersistentChannel"
output-channel="toRabbitChannel">
<int:header name="amqp_deliveryMode" ref="ampqHeaderEnricher" method="getNonPersistentDeliveryMode" />
</int:header-enricher>
<!-- Bean def -->
<bean id="ampqHeaderEnricher" class="org.example.ampq.AMPQHeaderEnricher"/>
The Java code looks like:
Code:
package org.example.ampq;
import org.springframework.amqp.core.MessageDeliveryMode;
public class AMPQHeaderEnricher {
public MessageDeliveryMode getNonPersistentDeliveryMode() {
return MessageDeliveryMode.NON_PERSISTENT;
}
}