@FunctionalInterface public interface MessagePostProcessor
AmqpTemplate#convertAndSend(Object, MessagePostProcessor)
where it can be used
to add/modify headers or properties after the message conversion has been performed. It
also can be used to modify inbound messages when receiving messages in listener
containers and AmqpTemplate
s.
It is a FunctionalInterface
and is often used as a lambda:
amqpTemplate.convertAndSend(routingKey, m -> { m.getMessageProperties().setDeliveryMode(DeliveryMode.NON_PERSISTENT); return m; });
Modifier and Type | Method and Description |
---|---|
Message |
postProcessMessage(Message message)
Change (or replace) the message.
|
default Message |
postProcessMessage(Message message,
Correlation correlation)
Change (or replace) the message and/or change its correlation data.
|
default Message |
postProcessMessage(Message message,
Correlation correlation,
String exchange,
String routingKey)
Change (or replace) the message and/or change its correlation data.
|
Message postProcessMessage(Message message) throws AmqpException
message
- the message.AmqpException
- an exception.default Message postProcessMessage(Message message, Correlation correlation)
message
- the message.correlation
- the correlation data.default Message postProcessMessage(Message message, Correlation correlation, String exchange, String routingKey)
message
- the message.correlation
- the correlation data.exchange
- the exchange to which the message is to be sent.routingKey
- the routing key.