Class RabbitAmqpAdmin
java.lang.Object
org.springframework.amqp.rabbitmq.client.RabbitAmqpAdmin
- All Implemented Interfaces:
org.springframework.amqp.core.AmqpAdmin, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
@ManagedResource(description="Admin Tasks")
public class RabbitAmqpAdmin
extends Object
implements org.springframework.amqp.core.AmqpAdmin, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.SmartLifecycle
The
AmqpAdmin implementation for RabbitMQ AMQP 1.0 client.- Since:
- 4.0
-
Field Summary
FieldsFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeclareBinding(org.springframework.amqp.core.Binding binding) voiddeclareExchange(org.springframework.amqp.core.Exchange exchange) @Nullable org.springframework.amqp.core.Queue@Nullable StringdeclareQueue(org.springframework.amqp.core.Queue queue) booleandeleteExchange(String exchangeName) booleandeleteQueue(String queueName) voiddeleteQueue(String queueName, boolean unused, boolean empty) @Nullable org.springframework.amqp.rabbit.core.DeclarationExceptionEventintgetPhase()@Nullable org.springframework.amqp.core.QueueInformationgetQueueInfo(String queueName) @Nullable PropertiesgetQueueProperties(String queueName) Returns 4 propertiesRabbitAdmin.QUEUE_NAME,RabbitAdmin.QUEUE_MESSAGE_COUNT,RabbitAdmin.QUEUE_CONSUMER_COUNT,QUEUE_TYPE, or null if the queue doesn't exist.voidDeclares all the exchanges, queues and bindings in the enclosing application context, if any.booleanbooleanintpurgeQueue(String queueName) voidpurgeQueue(String queueName, boolean noWait) voidremoveBinding(org.springframework.amqp.core.Binding binding) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) voidsetAutoStartup(boolean autoStartup) voidsetBeanName(String name) voidsetExplicitDeclarationsOnly(boolean explicitDeclarationsOnly) Set to true to only declareDeclarablebeans that are explicitly configured to be declared by this admin.voidsetIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions) voidsetTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) Set a task executor to use for async operations.voidstart()voidstop()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.amqp.core.AmqpAdmin
getManualDeclarableSetMethods inherited from interface org.springframework.context.SmartLifecycle
isPauseable, stop
-
Field Details
-
QUEUE_TYPE
- See Also:
-
-
Constructor Details
-
RabbitAmqpAdmin
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) - Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
setIgnoreDeclarationExceptions
public void setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions) -
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) Set a task executor to use for async operations. Currently only used withpurgeQueue(String, boolean).- Parameters:
taskExecutor- the executor to use.
-
setExplicitDeclarationsOnly
public void setExplicitDeclarationsOnly(boolean explicitDeclarationsOnly) Set to true to only declareDeclarablebeans that are explicitly configured to be declared by this admin.- Parameters:
explicitDeclarationsOnly- true to ignore beans with no admin declaration configuration.
-
getLastDeclarationExceptionEvent
public @Nullable org.springframework.amqp.rabbit.core.DeclarationExceptionEvent getLastDeclarationExceptionEvent()- Returns:
- the last
DeclarationExceptionEventthat was detected in this admin.
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
setAutoStartup
public void setAutoStartup(boolean autoStartup) -
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
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.- Specified by:
initializein interfaceorg.springframework.amqp.core.AmqpAdmin
-
declareExchange
public void declareExchange(org.springframework.amqp.core.Exchange exchange) - Specified by:
declareExchangein interfaceorg.springframework.amqp.core.AmqpAdmin
-
deleteExchange
@ManagedOperation(description="Delete an exchange from the broker") public boolean deleteExchange(String exchangeName) - Specified by:
deleteExchangein interfaceorg.springframework.amqp.core.AmqpAdmin
-
declareQueue
public @Nullable org.springframework.amqp.core.Queue declareQueue()- Specified by:
declareQueuein interfaceorg.springframework.amqp.core.AmqpAdmin
-
declareQueue
- Specified by:
declareQueuein interfaceorg.springframework.amqp.core.AmqpAdmin
-
deleteQueue
@ManagedOperation(description="Delete a queue from the broker") public boolean deleteQueue(String queueName) - Specified by:
deleteQueuein interfaceorg.springframework.amqp.core.AmqpAdmin
-
deleteQueue
@ManagedOperation(description="Delete a queue from the broker if unused and empty (when corresponding arguments are true") public void deleteQueue(String queueName, boolean unused, boolean empty) - Specified by:
deleteQueuein interfaceorg.springframework.amqp.core.AmqpAdmin
-
purgeQueue
@ManagedOperation(description="Purge a queue and optionally don't wait for the purge to occur") public void purgeQueue(String queueName, boolean noWait) - Specified by:
purgeQueuein interfaceorg.springframework.amqp.core.AmqpAdmin
-
purgeQueue
@ManagedOperation(description="Purge a queue and return the number of messages purged") public int purgeQueue(String queueName) - Specified by:
purgeQueuein interfaceorg.springframework.amqp.core.AmqpAdmin
-
declareBinding
public void declareBinding(org.springframework.amqp.core.Binding binding) - Specified by:
declareBindingin interfaceorg.springframework.amqp.core.AmqpAdmin
-
removeBinding
public void removeBinding(org.springframework.amqp.core.Binding binding) - Specified by:
removeBindingin interfaceorg.springframework.amqp.core.AmqpAdmin
-
getQueueProperties
@ManagedOperation(description="Get queue name, message count and consumer count") public @Nullable Properties getQueueProperties(String queueName) Returns 4 propertiesRabbitAdmin.QUEUE_NAME,RabbitAdmin.QUEUE_MESSAGE_COUNT,RabbitAdmin.QUEUE_CONSUMER_COUNT,QUEUE_TYPE, or null if the queue doesn't exist.- Specified by:
getQueuePropertiesin interfaceorg.springframework.amqp.core.AmqpAdmin
-
getQueueInfo
- Specified by:
getQueueInfoin interfaceorg.springframework.amqp.core.AmqpAdmin
-