Enum TransactionNamingStrategy
- java.lang.Object
-
- java.lang.Enum<TransactionNamingStrategy>
-
- org.apache.flink.connector.kafka.sink.TransactionNamingStrategy
-
- All Implemented Interfaces:
Serializable,Comparable<TransactionNamingStrategy>
@PublicEvolving public enum TransactionNamingStrategy extends Enum<TransactionNamingStrategy>
The strategy to name transactions. Naming strategy has implications on the resource consumption on the broker because each unique transaction name requires the broker to keep some metadata in memory for 7 days.All naming strategies use the format
transactionalIdPrefix-subtask-offsetwhere offset is calculated differently.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INCREMENTINGThe offset of the transaction name is a monotonically increasing number that mostly corresponds to the checkpoint id.POOLINGThis strategy reuses transaction names.
-
Field Summary
Fields Modifier and Type Field Description static TransactionNamingStrategyDEFAULTThe default transaction naming strategy.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TransactionNamingStrategyvalueOf(String name)Returns the enum constant of this type with the specified name.static TransactionNamingStrategy[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INCREMENTING
public static final TransactionNamingStrategy INCREMENTING
The offset of the transaction name is a monotonically increasing number that mostly corresponds to the checkpoint id. This strategy is wasteful in terms of resource consumption on the broker.This is exactly the same behavior as in flink-connector-kafka 3.X.
Switching to this strategy from
POOLINGis not supported.
-
POOLING
public static final TransactionNamingStrategy POOLING
This strategy reuses transaction names. It is more resource-friendly thanINCREMENTINGon the Kafka broker.It's a new strategy introduced in flink-connector-kafka 4.X. It requires Kafka 3.0+ and additional read permissions on the target topics.
The recommended way to switch to this strategy is to first take a checkpoint with flink-connector-kafka 4.X and then switch to this strategy. This will ensure that no transactions are left open from the previous run. Alternatively, you can use a savepoint from any version.
-
-
Field Detail
-
DEFAULT
public static final TransactionNamingStrategy DEFAULT
The default transaction naming strategy. Currently set toINCREMENTING, which is the same behavior of flink-connector-kafka 3.X.
-
-
Method Detail
-
values
public static TransactionNamingStrategy[] 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 (TransactionNamingStrategy c : TransactionNamingStrategy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TransactionNamingStrategy 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
-
-