Package org.apache.kafka.streams
Enum KafkaStreams.State
- java.lang.Object
-
- java.lang.Enum<KafkaStreams.State>
-
- org.apache.kafka.streams.KafkaStreams.State
-
- All Implemented Interfaces:
Serializable
,Comparable<KafkaStreams.State>
- Enclosing class:
- KafkaStreams
public static enum KafkaStreams.State extends Enum<KafkaStreams.State>
Kafka Streams states are the possible state that a Kafka Streams instance can be in. An instance must only be in one state at a time. The expected state transition with the following defined states is:+--------------+ +<----- | Created (0) | | +-----+--------+ | | | v | +----+--+------+ | | Re- | +<----- | Balancing (1)| -------->+ | +-----+-+------+ | | | ^ | | v | | | +--------------+ v | | Running (2) | -------->+ | +------+-------+ | | | | | v | | +------+-------+ +----+-------+ +-----> | Pending | | Pending | | Shutdown (3) | | Error (5) | +------+-------+ +-----+------+ | | v v +------+-------+ +-----+--------+ | Not | | Error (6) | | Running (4) | +--------------+ +--------------+
Note the following: - RUNNING state will transit to REBALANCING if any of its threads is in PARTITION_REVOKED or PARTITIONS_ASSIGNED state - REBALANCING state will transit to RUNNING if all of its threads are in RUNNING state - Any state except NOT_RUNNING, PENDING_ERROR or ERROR can go to PENDING_SHUTDOWN (whenever close is called) - Of special importance: If the global stream thread dies, or all stream threads die (or both) then the instance will be in the ERROR state. The user will not need to close it.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CREATED
ERROR
NOT_RUNNING
PENDING_ERROR
PENDING_SHUTDOWN
REBALANCING
RUNNING
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isRunningOrRebalancing()
boolean
isValidTransition(KafkaStreams.State newState)
static KafkaStreams.State
valueOf(String name)
Returns the enum constant of this type with the specified name.static KafkaStreams.State[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
CREATED
public static final KafkaStreams.State CREATED
-
REBALANCING
public static final KafkaStreams.State REBALANCING
-
RUNNING
public static final KafkaStreams.State RUNNING
-
PENDING_SHUTDOWN
public static final KafkaStreams.State PENDING_SHUTDOWN
-
NOT_RUNNING
public static final KafkaStreams.State NOT_RUNNING
-
PENDING_ERROR
public static final KafkaStreams.State PENDING_ERROR
-
ERROR
public static final KafkaStreams.State ERROR
-
-
Method Detail
-
values
public static KafkaStreams.State[] 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 (KafkaStreams.State c : KafkaStreams.State.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static KafkaStreams.State 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
-
isRunningOrRebalancing
public boolean isRunningOrRebalancing()
-
isValidTransition
public boolean isValidTransition(KafkaStreams.State newState)
-
-