com.taobao.drc.clusterclient.clustermanager.BatchGetPartitionRequest 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.JSON;
import com.taobao.drc.clusterclient.partition.PartitionRef;
import org.apache.http.client.config.RequestConfig;
import java.util.ArrayList;
import java.util.List;
/**
* @author yangyang
* @since 17/6/20
*/
public class BatchGetPartitionRequest extends AbstractControllerRequest {
static final String API_VERSION = "1.0";
private static final RequestConfig REQUEST_CONFIG = RequestConfig.custom()
.setConnectTimeout(60 * 1000)
.setConnectionRequestTimeout(60 * 1000)
.setSocketTimeout(60 * 1000)
.build();
private List partitionRefs = new ArrayList();
@Override
public String getAPIVersion() {
return API_VERSION;
}
@Override
public String getPath() {
return PatternUrlConstant.PATH_BATCH_GET_PARTITIONS;
}
@Override
public String getContent() {
return JSON.toJSONString(partitionRefs);
}
@Override
public RequestConfig getRequestConfig() {
return REQUEST_CONFIG;
}
public BatchGetPartitionRequest addPartition(String guid, String group, String partition) {
this.partitionRefs.add(new PartitionRef(guid, group, partition));
return this;
}
public List getPartitionRefs() {
return partitionRefs;
}
}