Package org.apache.pulsar.io.hdfs2.sink
Class HdfsAbstractSink<K,V>
java.lang.Object
org.apache.pulsar.io.hdfs2.AbstractHdfsConnector
org.apache.pulsar.io.hdfs2.sink.HdfsAbstractSink<K,V>
- All Implemented Interfaces:
AutoCloseable,org.apache.pulsar.io.core.Sink<V>
- Direct Known Subclasses:
HdfsAbstractSequenceFileSink,HdfsAbstractTextFileSink
public abstract class HdfsAbstractSink<K,V>
extends AbstractHdfsConnector
implements org.apache.pulsar.io.core.Sink<V>
A Simple abstract class for HDFS sink.
Users need to implement extractKeyValue function to use this sink.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HdfsSinkConfigprotected HdfsSyncThread<V>protected BlockingQueue<org.apache.pulsar.functions.api.Record<V>>Fields inherited from class org.apache.pulsar.io.hdfs2.AbstractHdfsConnector
compressionCodecFactory, connectorConfig, hdfsResources -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected final voidprotected abstract voidextractKeyValue(org.apache.pulsar.functions.api.Record<V> record) protected org.apache.hadoop.fs.FSDataOutputStreamprotected final org.apache.hadoop.fs.PathgetPath()protected final voidvoidMethods inherited from class org.apache.pulsar.io.hdfs2.AbstractHdfsConnector
checkHdfsUriForTimeout, getCompressionCodec, getCompressionCodecFactory, getConfiguration, getEncoding, getFileSystem, getFileSystem, getFileSystemAsUser, getUserGroupInformation, resetHDFSResourcesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pulsar.io.core.Sink
write
-
Field Details
-
hdfsSinkConfig
-
unackedRecords
-
syncThread
-
-
Constructor Details
-
HdfsAbstractSink
public HdfsAbstractSink()
-
-
Method Details
-
extractKeyValue
-
createWriter
- Throws:
IOException
-
open
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
connectToHdfs
- Throws:
IOException
-
getHdfsStream
protected org.apache.hadoop.fs.FSDataOutputStream getHdfsStream() throws IllegalArgumentException, IOException- Throws:
IllegalArgumentExceptionIOException
-
getPath
protected final org.apache.hadoop.fs.Path getPath() -
launchSyncThread
- Throws:
IOException
-