public class RabbitAdmin
extends java.lang.Object
implements org.springframework.amqp.core.AmqpAdmin, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_EXCHANGE_NAME
The default exchange name.
|
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses
|
static java.lang.Object |
QUEUE_CONSUMER_COUNT
Property key for the consumer count in the
Properties returned by
getQueueProperties(String). |
static java.lang.Object |
QUEUE_MESSAGE_COUNT
Property key for the message count in the
Properties returned by
getQueueProperties(String). |
static java.lang.Object |
QUEUE_NAME
Property key for the queue name in the
Properties returned by
getQueueProperties(String). |
| 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(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.
|
java.lang.String |
declareQueue(org.springframework.amqp.core.Queue queue)
Declare the given queue.
|
boolean |
deleteExchange(java.lang.String exchangeName) |
boolean |
deleteQueue(java.lang.String queueName) |
void |
deleteQueue(java.lang.String queueName,
boolean unused,
boolean empty) |
DeclarationExceptionEvent |
getLastDeclarationExceptionEvent() |
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 |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) |
void |
setAutoStartup(boolean autoStartup) |
void |
setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions) |
public static final java.lang.String DEFAULT_EXCHANGE_NAME
public static final java.lang.Object QUEUE_NAME
Properties returned by
getQueueProperties(String).public static final java.lang.Object QUEUE_MESSAGE_COUNT
Properties returned by
getQueueProperties(String).public static final java.lang.Object QUEUE_CONSUMER_COUNT
Properties returned by
getQueueProperties(String).protected final org.apache.commons.logging.Log logger
public RabbitAdmin(ConnectionFactory connectionFactory)
public void setAutoStartup(boolean autoStartup)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext in interface org.springframework.context.ApplicationContextAwarepublic void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwarepublic void setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions)
public DeclarationExceptionEvent getLastDeclarationExceptionEvent()
DeclarationExceptionEvent that was detected in this admin.public RabbitTemplate getRabbitTemplate()
public void declareExchange(org.springframework.amqp.core.Exchange exchange)
declareExchange in interface org.springframework.amqp.core.AmqpAdmin@ManagedOperation public boolean deleteExchange(java.lang.String exchangeName)
deleteExchange in interface org.springframework.amqp.core.AmqpAdmin@ManagedOperation public java.lang.String declareQueue(org.springframework.amqp.core.Queue queue)
declareQueue in interface org.springframework.amqp.core.AmqpAdminqueue - the queueignoreDeclarationExceptions is
true.@ManagedOperation public org.springframework.amqp.core.Queue declareQueue()
declareQueue in interface org.springframework.amqp.core.AmqpAdminignoreDeclarationExceptions
is true.@ManagedOperation public boolean deleteQueue(java.lang.String queueName)
deleteQueue in interface org.springframework.amqp.core.AmqpAdmin@ManagedOperation
public void deleteQueue(java.lang.String queueName,
boolean unused,
boolean empty)
deleteQueue in interface org.springframework.amqp.core.AmqpAdmin@ManagedOperation
public void purgeQueue(java.lang.String queueName,
boolean noWait)
purgeQueue in interface org.springframework.amqp.core.AmqpAdmin@ManagedOperation public void declareBinding(org.springframework.amqp.core.Binding binding)
declareBinding in interface org.springframework.amqp.core.AmqpAdmin@ManagedOperation public void removeBinding(org.springframework.amqp.core.Binding binding)
removeBinding in interface org.springframework.amqp.core.AmqpAdminpublic java.util.Properties getQueueProperties(java.lang.String queueName)
QUEUE_NAME, QUEUE_MESSAGE_COUNT,
QUEUE_CONSUMER_COUNT, or null if the queue doesn't exist.getQueueProperties in interface org.springframework.amqp.core.AmqpAdminpublic 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 org.springframework.beans.factory.InitializingBeanInitializingBean.afterPropertiesSet(),
initialize()public void initialize()