Package org.apache.pulsar.io.influxdb
Class BatchSink<T,R>
- java.lang.Object
-
- org.apache.pulsar.io.influxdb.BatchSink<T,R>
-
- Type Parameters:
T- The type of data to write to target databaseR- Pulsar message type, such as GenericRecord
- All Implemented Interfaces:
java.lang.AutoCloseable,org.apache.pulsar.io.core.Sink<R>
- Direct Known Subclasses:
InfluxDBAbstractSink,InfluxDBSink
public abstract class BatchSink<T,R> extends java.lang.Object implements org.apache.pulsar.io.core.Sink<R>Pulsar sink which can write data to target in batch.
-
-
Constructor Summary
Constructors Constructor Description BatchSink()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TbuildPoint(org.apache.pulsar.functions.api.Record<R> message)voidclose()protected java.lang.ObjectgetFiled(org.apache.pulsar.client.api.schema.GenericRecord record, java.lang.String fieldName)protected voidinit(long batchTimeMs, int batchSize)voidwrite(org.apache.pulsar.functions.api.Record<R> record)protected abstract voidwritePoints(java.util.List<T> points)
-
-
-
Method Detail
-
init
protected void init(long batchTimeMs, int batchSize)
-
write
public final void write(org.apache.pulsar.functions.api.Record<R> record)
- Specified by:
writein interfaceorg.apache.pulsar.io.core.Sink<T>
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
getFiled
protected java.lang.Object getFiled(org.apache.pulsar.client.api.schema.GenericRecord record, java.lang.String fieldName)
-
buildPoint
protected abstract T buildPoint(org.apache.pulsar.functions.api.Record<R> message) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writePoints
protected abstract void writePoints(java.util.List<T> points) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-