zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package org.jeecg.boot.starter.rabbitmq.exchange;
 
import org.springframework.amqp.core.CustomExchange;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * 延迟交换器构造器
 * @author: zyf
 * @date: 2019/3/8 13:31
 * @description:
 */
public class DelayExchangeBuilder {
    /**
     * 默认延迟消息交换器
     */
    public final static  String DEFAULT_DELAY_EXCHANGE = "jeecg.delayed.exchange";
    /**
     * 普通交换器
     */
    public final static  String DELAY_EXCHANGE = "jeecg.direct.exchange";
 
    /**
     * 构建延迟消息交换器
     * @return
     */
    public static CustomExchange buildExchange() {
        Map<String, Object> args = new HashMap<String, Object>();
        args.put("x-delayed-type", "direct");
        return new CustomExchange(DEFAULT_DELAY_EXCHANGE, "x-delayed-message", true, false, args);
    }
}