Enum Class FlinkKafkaProducer.Semantic
java.lang.Object
java.lang.Enum<FlinkKafkaProducer.Semantic>
org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.Semantic
- All Implemented Interfaces:
Serializable,Comparable<FlinkKafkaProducer.Semantic>,java.lang.constant.Constable
- Enclosing class:
FlinkKafkaProducer<IN>
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionSemantic.AT_LEAST_ONCE the Flink producer will wait for all outstanding messages in the Kafka buffers to be acknowledged by the Kafka producer on a checkpoint.Semantic.EXACTLY_ONCE the Flink producer will write all messages in a Kafka transaction that will be committed to Kafka on a checkpoint.Semantic.NONE means that nothing will be guaranteed. -
Method Summary
Modifier and TypeMethodDescriptionstatic FlinkKafkaProducer.SemanticReturns the enum constant of this class with the specified name.static FlinkKafkaProducer.Semantic[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
EXACTLY_ONCE
Semantic.EXACTLY_ONCE the Flink producer will write all messages in a Kafka transaction that will be committed to Kafka on a checkpoint.In this mode
FlinkKafkaProducersets up a pool ofFlinkKafkaInternalProducer. Between each checkpoint a Kafka transaction is created, which is committed onTwoPhaseCommitSinkFunction.notifyCheckpointComplete(long). If checkpoint complete notifications are running late,FlinkKafkaProducercan run out ofFlinkKafkaInternalProducers in the pool. In that case any subsequentFlinkKafkaProducer.snapshotState(FunctionSnapshotContext)requests will fail andFlinkKafkaProducerwill keep using theFlinkKafkaInternalProducerfrom the previous checkpoint. To decrease the chance of failing checkpoints there are four options:- decrease number of max concurrent checkpoints
- make checkpoints more reliable (so that they complete faster)
- increase the delay between checkpoints
- increase the size of
FlinkKafkaInternalProducers pool -
AT_LEAST_ONCE
Semantic.AT_LEAST_ONCE the Flink producer will wait for all outstanding messages in the Kafka buffers to be acknowledged by the Kafka producer on a checkpoint. -
NONE
Semantic.NONE means that nothing will be guaranteed. Messages can be lost and/or duplicated in case of failure.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-