-
Notifications
You must be signed in to change notification settings - Fork 39
/
JavaNetHttpPollingClientFactory.java
29 lines (20 loc) · 1.16 KB
/
JavaNetHttpPollingClientFactory.java
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 com.getindata.connectors.http.internal.table.lookup;
import java.net.http.HttpClient;
import org.apache.flink.api.common.serialization.DeserializationSchema;
import org.apache.flink.table.data.RowData;
import com.getindata.connectors.http.internal.HeaderPreprocessor;
import com.getindata.connectors.http.internal.PollingClientFactory;
import com.getindata.connectors.http.internal.utils.HttpHeaderUtils;
import com.getindata.connectors.http.internal.utils.JavaNetHttpClientFactory;
public class JavaNetHttpPollingClientFactory implements PollingClientFactory<RowData> {
@Override
public JavaNetHttpPollingClient createPollClient(
HttpLookupConfig options,
DeserializationSchema<RowData> schemaDecoder) {
HttpClient httpClient = JavaNetHttpClientFactory.createClient(options.getProperties());
// TODO Consider this to be injected as method argument or factory field
// so user could set this using API.
HeaderPreprocessor headerPreprocessor = HttpHeaderUtils.createDefaultHeaderPreprocessor();
return new JavaNetHttpPollingClient(httpClient, schemaDecoder, options, headerPreprocessor);
}
}