Class CloseOptions
java.lang.Object
org.apache.kafka.clients.consumer.CloseOptions
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum to specify the group membership operation upon leaving group. -
Method Summary
Modifier and TypeMethodDescriptionstatic CloseOptions
Static method to create aCloseOptions
with a specified group membership operation.timeout()
static CloseOptions
Static method to create aCloseOptions
with a custom timeout.Fluent method to set the group membership operation upon shutdown.withTimeout
(Duration timeout) Fluent method to set the timeout for the close process.
-
Method Details
-
timeout
Static method to create aCloseOptions
with a custom timeout.- Parameters:
timeout
- the maximum time to wait for the consumer to close.- Returns:
- a new
CloseOptions
instance with the specified timeout.
-
groupMembershipOperation
public static CloseOptions groupMembershipOperation(CloseOptions.GroupMembershipOperation operation) Static method to create aCloseOptions
with a specified group membership operation.- Parameters:
operation
- the group membership operation to apply. Must be one ofLEAVE_GROUP
,REMAIN_IN_GROUP
, orDEFAULT
.- Returns:
- a new
CloseOptions
instance with the specified group membership operation.
-
withTimeout
Fluent method to set the timeout for the close process.- Parameters:
timeout
- the maximum time to wait for the consumer to close. Ifnull
, the default timeout will be used.- Returns:
- this
CloseOptions
instance.
-
withGroupMembershipOperation
Fluent method to set the group membership operation upon shutdown.- Parameters:
operation
- the group membership operation to apply. Must be one ofLEAVE_GROUP
,REMAIN_IN_GROUP
, orDEFAULT
.- Returns:
- this
CloseOptions
instance.
-
groupMembershipOperation
-
timeout
-