Example usage for org.springframework.amqp.core AmqpMessageReturnedException AmqpMessageReturnedException

List of usage examples for org.springframework.amqp.core AmqpMessageReturnedException AmqpMessageReturnedException

Introduction

In this page you can find the example usage for org.springframework.amqp.core AmqpMessageReturnedException AmqpMessageReturnedException.

Prototype

public AmqpMessageReturnedException(String message, Message returnedMessage, int replyCode, String replyText,
            String exchange, String routingKey) 

Source Link

Usage

From source file:org.springframework.amqp.rabbit.AsyncRabbitTemplate.java

@Override
public void returnedMessage(Message message, int replyCode, String replyText, String exchange,
        String routingKey) {//from w w w . jav a  2s. co m
    MessageProperties messageProperties = message.getMessageProperties();
    String correlationId = messageProperties.getCorrelationId();
    if (StringUtils.hasText(correlationId)) {
        RabbitFuture<?> future = this.pending.remove(correlationId);
        if (future != null) {
            future.setException(new AmqpMessageReturnedException("Message returned", message, replyCode,
                    replyText, exchange, routingKey));
        } else {
            if (this.logger.isWarnEnabled()) {
                this.logger.warn("No pending reply - perhaps timed out? Message returned: " + message);
            }
        }
    }
}

From source file:org.springframework.amqp.rabbit.core.AsyncRabbitTemplate.java

@Override
public void returnedMessage(Message message, int replyCode, String replyText, String exchange,
        String routingKey) {//from  w w w.  j av a  2s . c  o m
    MessageProperties messageProperties = message.getMessageProperties();
    byte[] correlationId = messageProperties.getCorrelationId();
    if (correlationId != null) {
        RabbitFuture<?> future = this.pending.remove(new String(correlationId, this.charset));
        if (future != null) {
            future.setException(new AmqpMessageReturnedException("Message returned", message, replyCode,
                    replyText, exchange, routingKey));
        }
    }
}