Class MongoStreamingWrite
- java.lang.Object
-
- com.mongodb.spark.sql.connector.write.MongoStreamingWrite
-
- All Implemented Interfaces:
StreamingWrite
public class MongoStreamingWrite extends java.lang.Object implements StreamingWrite
MongoStreamingWrite defines how to write the data to MongoDB when streaming data.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort(long epochId, WriterCommitMessage[] messages)
The write was aborted due to a failure.void
commit(long epochId, WriterCommitMessage[] messages)
Logs the that the write has been committedStreamingDataWriterFactory
createStreamingWriterFactory(PhysicalWriteInfo info)
Creates the MongoDataWriterFactory instance will be serialized and sent to executors.
-
-
-
Method Detail
-
createStreamingWriterFactory
public StreamingDataWriterFactory createStreamingWriterFactory(PhysicalWriteInfo info)
Creates the MongoDataWriterFactory instance will be serialized and sent to executors.- Specified by:
createStreamingWriterFactory
in interfaceStreamingWrite
- Parameters:
info
- Physical information about the input data that will be written to this table.
-
commit
public void commit(long epochId, WriterCommitMessage[] messages)
Logs the that the write has been committed- Specified by:
commit
in interfaceStreamingWrite
- Parameters:
epochId
- the epoch id for the writemessages
- WriterCommitMessages
-
abort
public void abort(long epochId, WriterCommitMessage[] messages)
The write was aborted due to a failure.There is no automatic clean up, so the database state is undetermined.
- Specified by:
abort
in interfaceStreamingWrite
- Parameters:
epochId
- the epoch id for the writemessages
- the WriterCommitMessages- Throws:
DataException
- with information regarding the failed write
-
-