Example usage for org.springframework.amqp.core Queue arguments

List of usage examples for org.springframework.amqp.core Queue arguments

Introduction

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

Prototype

Map arguments

To view the source code for org.springframework.amqp.core Queue arguments.

Click Source Link

Usage

From source file:org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessor.java

private String declareQueue(org.springframework.amqp.rabbit.annotation.Queue bindingQueue) {
    String queueName = (String) resolveExpression(bindingQueue.value());
    boolean exclusive = false;
    boolean autoDelete = false;
    if (!StringUtils.hasText(queueName)) {
        queueName = UUID.randomUUID().toString();
        // default exclusive/autodelete to true when anonymous
        if (!StringUtils.hasText(bindingQueue.exclusive())
                || resolveExpressionAsBoolean(bindingQueue.exclusive())) {
            exclusive = true;/* w w w. jav  a  2 s.com*/
        }
        if (!StringUtils.hasText(bindingQueue.autoDelete())
                || resolveExpressionAsBoolean(bindingQueue.autoDelete())) {
            autoDelete = true;
        }
    } else {
        exclusive = resolveExpressionAsBoolean(bindingQueue.exclusive());
        autoDelete = resolveExpressionAsBoolean(bindingQueue.autoDelete());
    }
    Queue queue = new Queue(queueName, resolveExpressionAsBoolean(bindingQueue.durable()), exclusive,
            autoDelete, resolveArguments(bindingQueue.arguments()));
    queue.setIgnoreDeclarationExceptions(
            resolveExpressionAsBoolean(bindingQueue.ignoreDeclarationExceptions()));
    ((ConfigurableBeanFactory) this.beanFactory).registerSingleton(queueName + ++this.increment, queue);
    return queueName;
}