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

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

Introduction

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

Prototype

public HeadersExchange(String name, boolean durable, boolean autoDelete) 

Source Link

Usage

From source file:amqp.spring.camel.component.SpringAMQPEndpoint.java

org.springframework.amqp.core.Exchange createAMQPExchange() {
    if ("direct".equals(this.exchangeType)) {
        return new DirectExchange(this.exchangeName, this.durable, this.autodelete);
    } else if ("fanout".equals(this.exchangeType)) {
        return new FanoutExchange(this.exchangeName, this.durable, this.autodelete);
    } else if ("headers".equals(this.exchangeType)) {
        return new HeadersExchange(this.exchangeName, this.durable, this.autodelete);
    } else if ("topic".equals(this.exchangeType)) {
        return new TopicExchange(this.exchangeName, this.durable, this.autodelete);
        //We have a routing key but no explicit exchange type, assume topic exchange
    } else if (this.routingKey != null) {
        return new TopicExchange(this.exchangeName, this.durable, this.autodelete);
    } else {/*from www .j  av  a2s .  com*/
        return new DirectExchange(this.exchangeName, this.durable, this.autodelete);
    }
}

From source file:vn.topmedia.monitor.MonitorAppender.java

/**
 * Maybe declare the exchange.//from w w w  .ja va2 s .com
 */
protected void maybeDeclareExchange() {
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    if (declareExchange) {
        Exchange x;
        if ("topic".equals(exchangeType)) {
            x = new TopicExchange(exchangeName, durable, autoDelete);
        } else if ("direct".equals(exchangeType)) {
            x = new DirectExchange(exchangeName, durable, autoDelete);
        } else if ("fanout".equals(exchangeType)) {
            x = new FanoutExchange(exchangeName, durable, autoDelete);
        } else if ("headers".equals(exchangeType)) {
            x = new HeadersExchange(exchangeType, durable, autoDelete);
        } else {
            x = new TopicExchange(exchangeName, durable, autoDelete);
        }
        admin.declareExchange(x);
    }
}