Example usage for org.springframework.amqp.core AmqpTemplate receiveAndConvert

List of usage examples for org.springframework.amqp.core AmqpTemplate receiveAndConvert

Introduction

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

Prototype

@Nullable
Object receiveAndConvert() throws AmqpException;

Source Link

Document

Receive a message if there is one from a default queue and convert it to a Java object.

Usage

From source file:acromusashi.stream.component.rabbitmq.DefaultRabbitmqClient.java

/**
 * ??/*from  www. jav  a  2 s.  c o m*/
 * 
 * @param template ???
 * @return 
 * @throws InterruptedException ?????
 */
private Object receiveAndRetry(AmqpTemplate template) throws InterruptedException {
    Object message = null;
    try {
        message = template.receiveAndConvert();
    } catch (AmqpException ex) {
        // ???????????1??
        // ????????
        Thread.sleep(getRetryInterval());
        message = template.receiveAndConvert();
    }
    return message;
}