AmqpAdmin源码解读

AmqpAdmin类:spring-amqp的core中,主要用作管理queue、exchange以及bind关系,查看类中声明:为AMQP指定一组基本的AMQP管理操作,如下图。

/**
 * Specifies a basic set of portable AMQP administrative operations for AMQP > 0.9.
 *
 * @author Mark Pollack
 * @author Dave Syer
 * @author Gary Russell
 */
public interface AmqpAdmin {

类中主要有以下方法:

声明exchange

/**
	 * Declare an exchange.
	 * @param exchange the exchange to declare.
	 */
	void declareExchange(Exchange exchange);

删除exchange

/**
	 * 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.
	 * @param exchangeName the name of the exchange
	 * @return true if the exchange existed and was deleted
	 */
	boolean deleteExchange(String exchangeName);

声明队列

/**
	 * Declare a queue whose name is automatically named. It is created with exclusive = true, autoDelete=true, and
	 * durable = false.
	 *
	 * @return The queue.
	 */
	Queue declareQueue();

根据队列名删除队列

/**
	 * Delete a queue, without regard for whether it is in use or has messages on it.
	 * @param queueName the name of the queue.
	 * @return true if the queue existed and was deleted.
	 */
	boolean deleteQueue(String queueName);

根据队列使用情况或是否存储消息来确定删除

/**
	 * Delete a queue.
	 * @param queueName the name of the queue.
	 * @param unused true if the queue should be deleted only if not in use.
	 * @param empty true if the queue should be deleted only if empty.
	 */
	void deleteQueue(String queueName, boolean unused, boolean empty);

清楚队列消息,noWait确定是否等待

/**
	 * Purges the contents of the given queue.
	 * @param queueName the name of the queue.
	 * @param noWait true to not await completion of the purge.
	 */
	void purgeQueue(String queueName, boolean noWait);

声明一个queue与wxchange的bind关系

/**
	 * Declare a binding of a queue to an exchange.
	 * @param binding a description of the binding to declare.
	 */
	void declareBinding(Binding binding);

删除一个bind关系

/**
	 * Remove a binding of a queue to an exchange. Note unbindQueue/removeBinding was not introduced until 0.9 of the
	 * specification.
	 * @param binding a description of the binding to remove.
	 */
	void removeBinding(Binding binding

你可能感兴趣的:(中间件)