WangHan
2024-09-12 d5855a4926926698b740bc6c7ba489de47adb68b
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
package tech.powerjob.common.enums;
 
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
 
/**
 * transport protocol between server and worker
 *
 * @author tjq
 * @since 2021/2/7
 */
@Getter
public enum Protocol {
 
    AKKA,
    HTTP;
 
    public static Protocol of(String protocol) {
        if (StringUtils.isEmpty(protocol)) {
            return AKKA;
        }
        try {
            return Protocol.valueOf(protocol.toUpperCase());
        } catch (Exception ignore) {
        }
        // For compatibility with older versions, the AKKA protocol is used by default
        return AKKA;
    }
}