com.taobao.drc.clusterclient.clustermanager.ExpectedConsumerStatus Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of consumer-core Show documentation
Show all versions of consumer-core Show documentation
The java consumer core component for Data Transmission Service
package com.taobao.drc.clusterclient.clustermanager;
import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author yangyang
* @since 17/6/20
*/
public class ExpectedConsumerStatus {
public static final String SEQ_SEPARATOR = ":";
private String ip;
private String seq;
private String version;
private Integer errCode;
private String errMsg;
@JSONField(name = "partitions")
private List expectedPartitionStatusList = new ArrayList();
public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}
public Integer getErrCode() {
return errCode;
}
public void setErrCode(Integer errCode) {
this.errCode = errCode;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public List getExpectedPartitionStatusList() {
return expectedPartitionStatusList;
}
public void setExpectedPartitionStatusList(List expectedPartitionStatusList) {
this.expectedPartitionStatusList = expectedPartitionStatusList;
}
public boolean isNewSeqAllocated() {
return StringUtils.contains(seq, SEQ_SEPARATOR);
}
public String getLocalSeq() {
return StringUtils.substringBefore(seq, SEQ_SEPARATOR);
}
public String getAllocatedSeq() {
if (isNewSeqAllocated()) {
return StringUtils.substringAfter(seq, SEQ_SEPARATOR);
} else {
throw new IllegalStateException("Invalid seq [" + seq + "]");
}
}
public String toString() {
return "ExpectedConsumerStatus:" + "ip:" + ip + ",seq:" + seq + ",version:" + version + ",errCode:" + errCode
+ ",errMsg:" + errMsg + ",expectedPartitionStatusList size:" + expectedPartitionStatusList.size() + "";
}
}