public class RabbitAdmin extends Object implements AmqpAdmin, ApplicationContextAware, InitializingBean
Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_EXCHANGE_NAME |
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses
|
protected static Object |
QUEUE_CONSUMER_COUNT |
protected static Object |
QUEUE_MESSAGE_COUNT |
protected static Object |
QUEUE_NAME |
Constructor and Description |
---|
RabbitAdmin(ConnectionFactory connectionFactory) |
Modifier and Type | Method and Description |
---|---|
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
|
Properties |
getQueueProperties(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(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) |
void |
setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions) |
protected static final String DEFAULT_EXCHANGE_NAME
protected static final Object QUEUE_NAME
protected static final Object QUEUE_MESSAGE_COUNT
protected static final Object QUEUE_CONSUMER_COUNT
protected final org.apache.commons.logging.Log logger
public RabbitAdmin(ConnectionFactory connectionFactory)
public void setAutoStartup(boolean autoStartup)
public void setApplicationContext(ApplicationContext applicationContext)
setApplicationContext
in interface ApplicationContextAware
public void setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions)
public RabbitTemplate getRabbitTemplate()
public void declareExchange(Exchange exchange)
AmqpAdmin
declareExchange
in interface AmqpAdmin
exchange
- the exchange to declare.@ManagedOperation public boolean deleteExchange(String exchangeName)
AmqpAdmin
deleteExchange
in interface AmqpAdmin
exchangeName
- the name of the exchange@ManagedOperation public void declareQueue(Queue queue)
AmqpAdmin
declareQueue
in interface AmqpAdmin
queue
- the queue to declare@ManagedOperation public Queue declareQueue()
declareQueue
in interface AmqpAdmin
@ManagedOperation public boolean deleteQueue(String queueName)
AmqpAdmin
deleteQueue
in interface AmqpAdmin
queueName
- the name of the queue@ManagedOperation public void deleteQueue(String queueName, boolean unused, boolean empty)
AmqpAdmin
deleteQueue
in interface AmqpAdmin
queueName
- the name of the queueunused
- true if the queue should be deleted only if not in useempty
- true if the queue should be deleted only if empty@ManagedOperation public void purgeQueue(String queueName, boolean noWait)
AmqpAdmin
purgeQueue
in interface AmqpAdmin
queueName
- the name of the queuenoWait
- true to not await completion of the purge@ManagedOperation public void declareBinding(Binding binding)
AmqpAdmin
declareBinding
in interface AmqpAdmin
binding
- a description of the binding to declare.@ManagedOperation public void removeBinding(Binding binding)
AmqpAdmin
removeBinding
in interface AmqpAdmin
binding
- a description of the binding to remove.public Properties getQueueProperties(String queueName)
QUEUE_NAME
, QUEUE_MESSAGE_COUNT
,
QUEUE_CONSUMER_COUNT
, or null if the queue doesn't exist.getQueueProperties
in interface AmqpAdmin
queueName
- the name of the queue.public boolean isAutoStartup()
public void afterPropertiesSet()
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.afterPropertiesSet
in interface InitializingBean
InitializingBean.afterPropertiesSet()
,
initialize()
public void initialize()