public static RebalanceProtocol forId(byte id) {
            switch (id) {
                case 0:
                    return EAGER;
                case 1:
                    return COOPERATIVE;
                default:
                    throw new IllegalArgumentException("Unknown rebalance protocol id: " + id);
            }
        }
The rebalance protocol defines partition assignment and revocation semantics. The purpose is to establish a
consistent set of rules that all consumers in a group follow in order to transfer ownership of a partition.
{@link ConsumerPartitionAssignor} implementors can claim supporting one or more rebalance protocols via the
{@link ConsumerPartitionAssignor#supportedProtocols()}, and it is their responsibility to respect the rules
of those protocols in their {@link ConsumerPartitionAssignor#assign(Cluster, GroupSubscription)} implementations.
Failures to follow the rules of the supported protocols would lead to runtime error or undefined behavior.

The {@link RebalanceProtocol#EAGER} rebalance protocol requires a consumer to always revoke all its owned
partitions before participating in a rebalance event. It therefore allows a complete reshuffling of the assignment.

{@link RebalanceProtocol#COOPERATIVE} rebalance protocol allows a consumer to retain its currently owned
partitions before participating in a rebalance event. The assignor should not reassign any owned partitions
immediately, but instead may indicate consumers the need for partition revocation so that the revoked
partitions can be reassigned to other consumers in the next rebalance event. This is designed for sticky assignment
logic which attempts to minimize partition reassignment with cooperative adjustments.
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java