Enum 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>
- Enclosing class:
- FlinkKafkaProducer<IN>
public static enum FlinkKafkaProducer.Semantic extends Enum<FlinkKafkaProducer.Semantic>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AT_LEAST_ONCESemantic.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.EXACTLY_ONCESemantic.EXACTLY_ONCE the Flink producer will write all messages in a Kafka transaction that will be committed to Kafka on a checkpoint.NONESemantic.NONE means that nothing will be guaranteed.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FlinkKafkaProducer.SemanticvalueOf(String name)Returns the enum constant of this type with the specified name.static FlinkKafkaProducer.Semantic[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EXACTLY_ONCE
public static final FlinkKafkaProducer.Semantic 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
public static final FlinkKafkaProducer.Semantic 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
public static final FlinkKafkaProducer.Semantic NONE
Semantic.NONE means that nothing will be guaranteed. Messages can be lost and/or duplicated in case of failure.
-
-
Method Detail
-
values
public static FlinkKafkaProducer.Semantic[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FlinkKafkaProducer.Semantic c : FlinkKafkaProducer.Semantic.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FlinkKafkaProducer.Semantic valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
-