限流配置

This commit is contained in:
许晓东
2021-11-24 20:57:33 +08:00
parent 62569c4454
commit 1b028fcb4f
9 changed files with 250 additions and 5 deletions

View File

@@ -0,0 +1,22 @@
package com.xuxd.kafka.console.beans.dto;
import com.xuxd.kafka.console.beans.enums.ThrottleUnit;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
/**
* kafka-console-ui.
*
* @author xuxd
* @date 2021-11-24 19:37:10
**/
@Data
public class BrokerThrottleDTO {
private List<Integer> brokerList = new ArrayList<>();
private long throttle;
private ThrottleUnit unit;
}

View File

@@ -0,0 +1,18 @@
package com.xuxd.kafka.console.beans.enums;
/**
* kafka-console-ui.
*
* @author xuxd
* @date 2021-11-24 19:38:00
**/
public enum ThrottleUnit {
KB, MB;
public long toKb(long size) {
if (this == MB) {
return 1024 * size;
}
return size;
}
}