admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
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
package com.yeshi.fanli.util.mq.rocket;
 
public class RocketMQUtil {
    // "1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h";
    private static int[] DELAYS_S = new int[] { 1, 5, 10, 30, 60, 120, 180, 240, 300, 420, 480, 540, 600, 1200, 1800,
            3600, 7200 };
 
    /**
     * 获取延时等级
     * @Title: getDelayLevel
     * @Description: 
     * @param s
     * @return 
     * Integer 返回类型
     * @throws
     */
    public static Integer getDelayLevel(int s) {
        for (int i=0;i<DELAYS_S.length;i++) {
            if(DELAYS_S[i]==s)
                return i+1;
        }
        return null;
    }
 
}