Class CloseOptions

java.lang.Object
org.apache.kafka.clients.consumer.CloseOptions

public class CloseOptions extends Object
  • Method Details

    • timeout

      public static CloseOptions timeout(Duration timeout)
      Static method to create a CloseOptions 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 a CloseOptions with a specified group membership operation.
      Parameters:
      operation - the group membership operation to apply. Must be one of LEAVE_GROUP, REMAIN_IN_GROUP, or DEFAULT.
      Returns:
      a new CloseOptions instance with the specified group membership operation.
    • withTimeout

      public CloseOptions withTimeout(Duration timeout)
      Fluent method to set the timeout for the close process.
      Parameters:
      timeout - the maximum time to wait for the consumer to close. If null, the default timeout will be used.
      Returns:
      this CloseOptions instance.
    • withGroupMembershipOperation

      public CloseOptions withGroupMembershipOperation(CloseOptions.GroupMembershipOperation operation)
      Fluent method to set the group membership operation upon shutdown.
      Parameters:
      operation - the group membership operation to apply. Must be one of LEAVE_GROUP, REMAIN_IN_GROUP, or DEFAULT.
      Returns:
      this CloseOptions instance.
    • groupMembershipOperation

      public CloseOptions.GroupMembershipOperation groupMembershipOperation()
    • timeout

      public Optional<Duration> timeout()