Interface MessagePostProcessor

All Known Implementing Classes:
AbstractCompressingPostProcessor, AbstractDecompressingPostProcessor, AbstractDeflaterPostProcessor, DeflaterPostProcessor, DelegatingDecompressingPostProcessor, GUnzipPostProcessor, GZipPostProcessor, InflaterPostProcessor, UnzipPostProcessor, ZipPostProcessor
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface MessagePostProcessor
Used in several places in the framework, such as 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 AmqpTemplates.

It is a FunctionalInterface and is often used as a lambda:

 amqpTemplate.convertAndSend(routingKey, m -> {
     m.getMessageProperties().setDeliveryMode(DeliveryMode.NON_PERSISTENT);
     return m;
 });
 
Author:
Mark Pollack, Gary Russell
  • Method Details

    • postProcessMessage

      Message postProcessMessage(Message message) throws AmqpException
      Change (or replace) the message.
      Parameters:
      message - the message.
      Returns:
      the message.
      Throws:
      AmqpException - an exception.
    • postProcessMessage

      default Message postProcessMessage(Message message, Correlation correlation)
      Change (or replace) the message and/or change its correlation data. Only applies to outbound messages.
      Parameters:
      message - the message.
      correlation - the correlation data.
      Returns:
      the message.
      Since:
      1.6.7
    • postProcessMessage

      default Message postProcessMessage(Message message, Correlation correlation, String exchange, String routingKey)
      Change (or replace) the message and/or change its correlation data. Only applies to outbound messages.
      Parameters:
      message - the message.
      correlation - the correlation data.
      exchange - the exchange to which the message is to be sent.
      routingKey - the routing key.
      Returns:
      the message.
      Since:
      2.3.4