Spring AMQP

org.springframework.amqp.rabbit.core
Class RabbitAdmin

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

public class RabbitAdmin
extends Object
implements AmqpAdmin, ApplicationContextAware, InitializingBean

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

Author:
Mark Pollack, Mark Fisher, Dave Syer

Field Summary
protected  org.apache.commons.logging.Log logger
          Logger available to subclasses
 
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(Binding binding)
          Declare a binding of a queue to an exchange.
 void declareExchange(Exchange exchange)
          Declare an exchange
 Queue declareQueue()
          Declares a server-named exclusive, autodelete, non-durable queue.
 void declareQueue(Queue queue)
          Declare the given queue
 boolean deleteExchange(String exchangeName)
          Delete an exchange.
 boolean deleteQueue(String queueName)
          Delete a queue, without regard for whether it is in use or has messages on it
 void deleteQueue(String queueName, boolean unused, boolean empty)
          Delete a queue
 RabbitTemplate getRabbitTemplate()
           
 void initialize()
          Declares all the exchanges, queues and bindings in the enclosing application context, if any.
 boolean isAutoStartup()
           
 void purgeQueue(String queueName, boolean noWait)
          Purges the contents of the given queue.
 void removeBinding(Binding binding)
          Remove a binding of a queue to an exchange.
 void setApplicationContext(ApplicationContext applicationContext)
           
 void setAutoStartup(boolean autoStartup)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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(ApplicationContext applicationContext)
Specified by:
setApplicationContext in interface ApplicationContextAware

getRabbitTemplate

public RabbitTemplate getRabbitTemplate()

declareExchange

public void declareExchange(Exchange exchange)
Description copied from interface: AmqpAdmin
Declare an exchange

Specified by:
declareExchange in interface AmqpAdmin
Parameters:
exchange - the exchange to declare.

deleteExchange

@ManagedOperation
public boolean deleteExchange(String exchangeName)
Description copied from interface: AmqpAdmin
Delete an exchange. Look at implementation specific subclass for implementation specific behavior, for example for RabbitMQ this will delete the exchange without regard for whether it is in use or not.

Specified by:
deleteExchange in interface AmqpAdmin
Parameters:
exchangeName - the name of the exchange
Returns:
true if the exchange existed and was deleted

declareQueue

@ManagedOperation
public void declareQueue(Queue queue)
Description copied from interface: AmqpAdmin
Declare the given queue

Specified by:
declareQueue in interface AmqpAdmin
Parameters:
queue - the queue to declare

declareQueue

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

Specified by:
declareQueue in interface AmqpAdmin

deleteQueue

@ManagedOperation
public boolean deleteQueue(String queueName)
Description copied from interface: AmqpAdmin
Delete a queue, without regard for whether it is in use or has messages on it

Specified by:
deleteQueue in interface AmqpAdmin
Parameters:
queueName - the name of the queue
Returns:
true if the queue existed and was deleted

deleteQueue

@ManagedOperation
public void deleteQueue(String queueName,
                                         boolean unused,
                                         boolean empty)
Description copied from interface: AmqpAdmin
Delete a queue

Specified by:
deleteQueue in interface AmqpAdmin
Parameters:
queueName - the name of the queue
unused - true if the queue should be deleted only if not in use
empty - true if the queue should be deleted only if empty

purgeQueue

@ManagedOperation
public void purgeQueue(String queueName,
                                        boolean noWait)
Description copied from interface: AmqpAdmin
Purges the contents of the given queue.

Specified by:
purgeQueue in interface AmqpAdmin
Parameters:
queueName - the name of the queue
noWait - true to not await completion of the purge

declareBinding

@ManagedOperation
public void declareBinding(Binding binding)
Description copied from interface: AmqpAdmin
Declare a binding of a queue to an exchange.

Specified by:
declareBinding in interface AmqpAdmin
Parameters:
binding - a description of the binding to declare.

removeBinding

@ManagedOperation
public void removeBinding(Binding binding)
Description copied from interface: AmqpAdmin
Remove a binding of a queue to an exchange. Note unbindQueue/removeBinding was not introduced until 0.9 of the specification.

Specified by:
removeBinding in interface AmqpAdmin
Parameters:
binding - a description of the binding to remove.

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 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.


Spring AMQP

Copyright © 2011. All Rights Reserved.