Skip to content

Clarify GetRebalanceProtocol() return value for KIP-848 / group.protocol=consumer #1508

@harilsatra

Description

Context

We maintain a shared library used by multiple Kafka consumers. We want to migrate to the KIP-848 consumer protocol in an opt-in way, so during the migration we must support both:

  • Classic protocol (group.protocol=classic, or default): rebalance callback uses Assign() / Unassign().
  • New consumer protocol (group.protocol=consumer): rebalance callback uses IncrementalAssign() / IncrementalUnassign() only, as described in the KIP-848 migration guide.

We plan to branch in the rebalance callback based on the current protocol (two-way: classic vs new) and call the appropriate assign APIs.

Current behavior / documentation

We intended to use GetRebalanceProtocol() to detect which protocol is in use. The in-code comment currently says:

// GetRebalanceProtocol returns the current consumer group rebalance protocol,
// which is either "EAGER" or "COOPERATIVE".
// If the rebalance protocol is not known in the current state an empty string
// is returned.
// Should typically only be called during rebalancing.
func (c *Consumer) GetRebalanceProtocol() string {.}

That only describes the classic protocol (eager vs cooperative assignors). It does not say what is returned when group.protocol=consumer (KIP-848), where there is no client-side EAGER/COOPERATIVE choice and the protocol is fully incremental.

Question

What does GetRebalanceProtocol() return in this case? (e.g. "consumer", "COOPERATIVE", something else, or is it unspecified?)

Environment

  • confluent-kafka-go: v2.13.0
  • go: v1.23.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions