Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.core;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import io.bitsensor.plugins.shaded.org.apache.commons.logging.Log;
import io.bitsensor.plugins.shaded.org.apache.commons.logging.LogFactory;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.AmqpException;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.core.AmqpAdmin;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.core.Binding;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.core.Declarable;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.core.Exchange;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.core.Queue;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.connection.ChannelProxy;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.connection.Connection;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.connection.ConnectionFactory;
import io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.connection.ConnectionListener;
import io.bitsensor.plugins.shaded.org.springframework.beans.factory.InitializingBean;
import io.bitsensor.plugins.shaded.org.springframework.context.ApplicationContext;
import io.bitsensor.plugins.shaded.org.springframework.context.ApplicationContextAware;
import io.bitsensor.plugins.shaded.org.springframework.context.ApplicationEventPublisher;
import io.bitsensor.plugins.shaded.org.springframework.context.ApplicationEventPublisherAware;
import io.bitsensor.plugins.shaded.org.springframework.jmx.export.annotation.ManagedOperation;
import io.bitsensor.plugins.shaded.org.springframework.util.Assert;
import io.bitsensor.plugins.shaded.com.rabbitmq.client.AMQP.Queue.DeclareOk;
import io.bitsensor.plugins.shaded.com.rabbitmq.client.Channel;
/**
* RabbitMQ implementation of portable AMQP administrative operations for AMQP >= 0.9.1
*
* @author Mark Pollack
* @author Mark Fisher
* @author Dave Syer
* @author Ed Scriven
* @author Gary Russell
* @author Artem Bilan
*/
public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, ApplicationEventPublisherAware,
InitializingBean {
/**
* The default exchange name.
*/
public static final String DEFAULT_EXCHANGE_NAME = "";
/**
* Property key for the queue name in the {@link Properties} returned by
* {@link #getQueueProperties(String)}.
*/
public static final Object QUEUE_NAME = "QUEUE_NAME";
/**
* Property key for the message count in the {@link Properties} returned by
* {@link #getQueueProperties(String)}.
*/
public static final Object QUEUE_MESSAGE_COUNT = "QUEUE_MESSAGE_COUNT";
/**
* Property key for the consumer count in the {@link Properties} returned by
* {@link #getQueueProperties(String)}.
*/
public static final Object QUEUE_CONSUMER_COUNT = "QUEUE_CONSUMER_COUNT";
private static final String DELAYED_MESSAGE_EXCHANGE = "x-delayed-message";
/** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass());
private final RabbitTemplate rabbitTemplate;
private volatile boolean running = false;
private volatile boolean autoStartup = true;
private volatile ApplicationContext applicationContext;
private volatile boolean ignoreDeclarationExceptions;
private final Object lifecycleMonitor = new Object();
private final ConnectionFactory connectionFactory;
private ApplicationEventPublisher applicationEventPublisher;
private volatile DeclarationExceptionEvent lastDeclarationExceptionEvent;
public RabbitAdmin(ConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
this.rabbitTemplate = new RabbitTemplate(connectionFactory);
}
public void setAutoStartup(boolean autoStartup) {
this.autoStartup = autoStartup;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
public void setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions) {
this.ignoreDeclarationExceptions = ignoreDeclarationExceptions;
}
/**
* @return the last {@link DeclarationExceptionEvent} that was detected in this admin.
*
* @since 1.6
*/
public DeclarationExceptionEvent getLastDeclarationExceptionEvent() {
return this.lastDeclarationExceptionEvent;
}
public RabbitTemplate getRabbitTemplate() {
return this.rabbitTemplate;
}
// Exchange operations
@Override
public void declareExchange(final Exchange exchange) {
try {
this.rabbitTemplate.execute(new ChannelCallback