T - The data class by sink accept. Only support SeaTunnelRow at now.CommitInfoT - The type of commit message.StateT - The type of state.public interface SinkWriter<T,CommitInfoT,StateT>
| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
SinkWriter.Context |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
abortPrepare()
Used to abort the
prepareCommit(), if the prepareCommit failed, there is no
CommitInfoT, so the rollback work cannot be done by SinkCommitter. |
default void |
applySchemaChange(SchemaChangeEvent event)
apply schema change to third party data receiver.
|
void |
close()
call it when SinkWriter close
|
Optional<CommitInfoT> |
prepareCommit()
prepare the commit, will be called before
snapshotState(long checkpointId). |
default List<StateT> |
snapshotState(long checkpointId) |
void |
write(T element)
write data to third party data receiver.
|
void write(T element) throws IOException
element - the data need be written.IOException - throw IOException when write data failed.default void applySchemaChange(SchemaChangeEvent event) throws IOException
event - IOExceptionOptional<CommitInfoT> prepareCommit() throws IOException
snapshotState(long checkpointId). If you
need to use 2pc, you can return the commit info in this method, and receive the commit info
in SinkCommitter.commit(List). If this method failed (by throw exception), **Only**
Spark engine will call abortPrepare()IOExceptiondefault List<StateT> snapshotState(long checkpointId) throws IOException
IOException - if fail to snapshot writer's state.void abortPrepare()
prepareCommit(), if the prepareCommit failed, there is no
CommitInfoT, so the rollback work cannot be done by SinkCommitter. But we can use
this method to rollback side effects of prepareCommit(). Only use it in Spark engine
at now.void close()
throws IOException
IOException - if close failedCopyright © 2024 The Apache Software Foundation. All rights reserved.