new Queue(REGISTER_DELAY_QUEUE, true, false, false, params)

@Bean
    public Queue delayProcessQueue() {
        Map<String, Object> params = new HashMap<>();
        // x-dead-letter-exchange 声明了队列里的死信转发到的DLX名称,
        params.put("x-dead-letter-exchange", REGISTER_EXCHANGE_NAME);
        // x-dead-letter-routing-key 声明了这些死信在转发时携带的 routing-key 名称。
        params.put("x-dead-letter-routing-key", ROUTING_KEY);
        return new Queue(REGISTER_DELAY_QUEUE, true, false, false, params);
    }

解释上述代码中的 Queue类的API:

// 构造一个新的队列,给出一个名称、耐久性标志、排他和自动删除标志和参数;

construct a new queue,given a name,durability flag, exclusive and auto-delete flag,and arguments;

// 队列名字
name;

// 如果声明一个持久队列(该队列将在服务器重新启动后继续存在),则为true;
true if we are declaring a durable queue(the queue will survive a server restart) ; 

// 如果我们声明一个排他队列(该队列将仅由声明者的连接使用),则为true;
true if we are  declaring an exclusive queue(the queue will only be used by the declarer`s connection);

// 如果服务器不再使用时应删除队列,则为true;
true if the server should delete the queue  when it is no longer in use; 

// 用于声明队列的参数;
the argument used to declare hthe queue;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值