Class BackchannelFactory
- java.lang.Object
-
- org.apache.flink.connector.kafka.sink.internal.BackchannelFactory
-
@Internal @ThreadSafe public class BackchannelFactory extends Object
Creates and manages backchannels for the Kafka sink. The backchannels are used to communicate between the Kafka committer and writer.Each backchannel is uniquely identified by the subtask id, attempt number, and transactional id prefix. The subtask id prevents concurrent subtasks of the same sink from conflicting. The attempt number prevents conflicts for task-local recovery. The transactional id prefix prevents conflicts between multiple Kafka sinks.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BackchannelFactorygetInstance()Gets the singleton instance of theBackchannelFactory.<T> ReadableBackchannel<T>getReadableBackchannel(int subtaskId, int attemptNumber, String transactionalIdPrefix)Gets aReadableBackchannelfor the given subtask, attempt, and transactional id prefix.<T> WritableBackchannel<T>getWritableBackchannel(int subtaskId, int attemptNumber, String transactionalIdPrefix)Gets aWritableBackchannelfor the given subtask, attempt, and transactional id prefix.
-
-
-
Method Detail
-
getInstance
public static BackchannelFactory getInstance()
Gets the singleton instance of theBackchannelFactory.
-
getReadableBackchannel
public <T> ReadableBackchannel<T> getReadableBackchannel(int subtaskId, int attemptNumber, String transactionalIdPrefix)
Gets aReadableBackchannelfor the given subtask, attempt, and transactional id prefix.If this method is called twice with the same arguments, it will throw an exception as it indicates that the transactional id prefix is being reused for multiple Kafka sinks.
If the corresponding
getWritableBackchannel(int, int, String)is called, theBackchannel.isEstablished()will return true.
-
getWritableBackchannel
public <T> WritableBackchannel<T> getWritableBackchannel(int subtaskId, int attemptNumber, String transactionalIdPrefix)
Gets aWritableBackchannelfor the given subtask, attempt, and transactional id prefix.If this method is called twice with the same arguments, it will throw an exception as it indicates that the transactional id prefix is being reused for multiple Kafka sinks.
If the corresponding
getReadableBackchannel(int, int, String)is called, theBackchannel.isEstablished()will return true.
-
-