com.clickzetta.client.RealtimeStreamBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clickzetta-java Show documentation
Show all versions of clickzetta-java Show documentation
The java SDK for clickzetta's Lakehouse
package com.clickzetta.client;
import com.clickzetta.platform.client.api.Options;
import java.io.IOException;
public class RealtimeStreamBuilder {
private ClickZettaClient client;
private String schema;
private String table;
private Options options = Options.DEFAULT;
private RowStream.RealTimeOperate operate = RowStream.RealTimeOperate.CDC;
RealtimeStreamBuilder(ClickZettaClient client) {
this.client = client;
}
public RealtimeStreamBuilder schema(String schema) {
this.schema = schema;
return this;
}
public RealtimeStreamBuilder table(String table) {
this.table = table;
return this;
}
public RealtimeStreamBuilder options(Options options) {
this.options = options;
return this;
}
public RealtimeStreamBuilder operate(RowStream.RealTimeOperate operate) {
this.operate = operate;
return this;
}
private void validate() {
if (client == null) {
throw new IllegalArgumentException("client is null");
}
if (schema == null || schema.isEmpty()) {
if (client.getSchema() == null || client.getSchema().isEmpty()) {
throw new IllegalArgumentException("schema is null or empty");
} else {
schema = client.getSchema();
}
}
if (table == null || table.isEmpty()) {
throw new IllegalArgumentException("table is null or empty");
}
if (options == null) {
throw new IllegalArgumentException("options is null");
}
if (operate == null) {
throw new IllegalArgumentException("operate is null");
}
}
public RealtimeStream build() throws IOException {
validate();
return new RealtimeStream(client, operate, schema, table, options);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy