org.springframework.amqp.rabbit.core
Class RabbitAdmin

java.lang.Object
  extended by org.springframework.amqp.rabbit.core.RabbitAdmin
All Implemented Interfaces:
org.springframework.amqp.core.AmqpAdmin, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class RabbitAdmin
extends java.lang.Object
implements org.springframework.amqp.core.AmqpAdmin, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean

RabbitMQ implementation of portable AMQP administrative operations for AMQP >= 0.9.1


Field Summary
protected static java.lang.String DEFAULT_EXCHANGE_NAME
           
protected  org.apache.commons.logging.Log logger
          Logger available to subclasses
protected static java.lang.Object QUEUE_CONSUMER_COUNT
           
protected static java.lang.Object QUEUE_MESSAGE_COUNT
           
protected static java.lang.Object QUEUE_NAME
           
 
Constructor Summary
RabbitAdmin(ConnectionFactory connectionFactory)
           
 
Method Summary
 void afterPropertiesSet()
          If autoStartup is set to true, registers a callback on the ConnectionFactory to declare all exchanges and queues in the enclosing application context.
 void declareBinding(org.springframework.amqp.core.Binding binding)
           
 void declareExchange(org.springframework.amqp.core.Exchange exchange)
           
 org.springframework.amqp.core.Queue declareQueue()
          Declares a server-named exclusive, autodelete, non-durable queue.
 void declareQueue(org.springframework.amqp.core.Queue queue)
           
 boolean deleteExchange(java.lang.String exchangeName)
           
 boolean deleteQueue(java.lang.String queueName)
           
 void deleteQueue(java.lang.String queueName, boolean unused, boolean empty)
           
 java.util.Properties getQueueProperties(java.lang.String queueName)
          Returns 3 properties QUEUE_NAME, QUEUE_MESSAGE_COUNT, QUEUE_CONSUMER_COUNT, or null if the queue doesn't exist.
 RabbitTemplate getRabbitTemplate()
           
 void initialize()
          Declares all the exchanges, queues and bindings in the enclosing application context, if any.
 boolean isAutoStartup()
           
 void purgeQueue(java.lang.String queueName, boolean noWait)
           
 void removeBinding(org.springframework.amqp.core.Binding binding)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setAutoStartup(boolean autoStartup)
           
 void setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EXCHANGE_NAME

protected static final java.lang.String DEFAULT_EXCHANGE_NAME
See Also:
Constant Field Values

QUEUE_NAME

protected static final java.lang.Object QUEUE_NAME

QUEUE_MESSAGE_COUNT

protected static final java.lang.Object QUEUE_MESSAGE_COUNT

QUEUE_CONSUMER_COUNT

protected static final java.lang.Object QUEUE_CONSUMER_COUNT

logger

protected final org.apache.commons.logging.Log logger
Logger available to subclasses

Constructor Detail

RabbitAdmin

public RabbitAdmin(ConnectionFactory connectionFactory)
Method Detail

setAutoStartup

public void setAutoStartup(boolean autoStartup)

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware

setIgnoreDeclarationExceptions

public void setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions)

getRabbitTemplate

public RabbitTemplate getRabbitTemplate()

declareExchange

public void declareExchange(org.springframework.amqp.core.Exchange exchange)
Specified by:
declareExchange in interface org.springframework.amqp.core.AmqpAdmin

deleteExchange

@ManagedOperation
public boolean deleteExchange(java.lang.String exchangeName)
Specified by:
deleteExchange in interface org.springframework.amqp.core.AmqpAdmin

declareQueue

@ManagedOperation
public void declareQueue(org.springframework.amqp.core.Queue queue)
Specified by:
declareQueue in interface org.springframework.amqp.core.AmqpAdmin

declareQueue

@ManagedOperation
public org.springframework.amqp.core.Queue declareQueue()
Declares a server-named exclusive, autodelete, non-durable queue.

Specified by:
declareQueue in interface org.springframework.amqp.core.AmqpAdmin

deleteQueue

@ManagedOperation
public boolean deleteQueue(java.lang.String queueName)
Specified by:
deleteQueue in interface org.springframework.amqp.core.AmqpAdmin

deleteQueue

@ManagedOperation
public void deleteQueue(java.lang.String queueName,
                                         boolean unused,
                                         boolean empty)
Specified by:
deleteQueue in interface org.springframework.amqp.core.AmqpAdmin

purgeQueue

@ManagedOperation
public void purgeQueue(java.lang.String queueName,
                                        boolean noWait)
Specified by:
purgeQueue in interface org.springframework.amqp.core.AmqpAdmin

declareBinding

@ManagedOperation
public void declareBinding(org.springframework.amqp.core.Binding binding)
Specified by:
declareBinding in interface org.springframework.amqp.core.AmqpAdmin

removeBinding

@ManagedOperation
public void removeBinding(org.springframework.amqp.core.Binding binding)
Specified by:
removeBinding in interface org.springframework.amqp.core.AmqpAdmin

getQueueProperties

public java.util.Properties getQueueProperties(java.lang.String queueName)
Returns 3 properties QUEUE_NAME, QUEUE_MESSAGE_COUNT, QUEUE_CONSUMER_COUNT, or null if the queue doesn't exist.

Specified by:
getQueueProperties in interface org.springframework.amqp.core.AmqpAdmin

isAutoStartup

public boolean isAutoStartup()

afterPropertiesSet

public void afterPropertiesSet()
If autoStartup is set to true, registers a callback on the ConnectionFactory to declare all exchanges and queues in the enclosing application context. If the callback fails then it may cause other clients of the connection factory to fail, but since only exchanges, queues and bindings are declared failure is not expected.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
See Also:
InitializingBean.afterPropertiesSet(), initialize()

initialize

public void initialize()
Declares all the exchanges, queues and bindings in the enclosing application context, if any. It should be safe (but unnecessary) to call this method more than once.