All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dell.cpsd.common.rabbitmq.processor.PropertiesPostProcessor Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
/**
 * Copyright © 2017 Dell Inc. or its subsidiaries.  All Rights Reserved.
 * Dell EMC Confidential/Proprietary Information
 */

package com.dell.cpsd.common.rabbitmq.processor;

import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessagePostProcessor;
import org.springframework.amqp.core.MessageProperties;

/**
 * The default message post processor to handle message properties.
 * 

*

* Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved. * Dell EMC Confidential/Proprietary Information *

* @version 1.0 * @since SINCE-TDB */ public class PropertiesPostProcessor implements MessagePostProcessor { /** * The properties to use in post processing of the message. */ private M properties = null; /** * PropertiesPostProcessor constructor * * @param properties The properties to use in post processing. * @since 1.0 */ public PropertiesPostProcessor(M properties) { super(); if (properties == null) { throw new IllegalArgumentException("The message properties container is null."); } this.properties = properties; } /** * {@inheritDoc} */ @Override public Message postProcessMessage(final Message message) throws AmqpException { if (message == null) { return message; } final MessageProperties messageProperties = message.getMessageProperties(); messageProperties.setTimestamp(this.properties.getTimestamp()); final byte[] correlationId = this.properties.getCorrelationId(); messageProperties.setCorrelationId(correlationId); messageProperties.setCorrelationIdString(this.properties.getCorrelationIdString()); messageProperties.setReplyTo(this.properties.getReplyTo()); messageProperties.setExpiration(this.properties.getExpiration()); return message; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy