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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值