View Source KafkaEx.Protocol.Kayrock.Heartbeat.RequestHelpers (kafka_ex v1.0.0-rc.1)

Shared helper functions for building Heartbeat requests across all versions.

Version differences:

  • V0-V2: group_id, generation_id, member_id (all schema-identical)
  • V3-V4: Adds group_instance_id for static membership (KIP-345)
  • V4: Flexible version (KIP-482) with compact encoding -- Kayrock handles encoding

Summary

Functions

Builds a Heartbeat request by populating the request template with extracted fields. This is shared logic between V0-V2 requests as they have identical structure.

Builds a Heartbeat V3+ request by populating the request template with common fields plus group_instance_id for static membership (KIP-345).

Extracts common fields from request options.

Functions

Link to this function

build_request_from_template(request_template, opts)

View Source
@spec build_request_from_template(map(), Keyword.t()) :: map()

Builds a Heartbeat request by populating the request template with extracted fields. This is shared logic between V0-V2 requests as they have identical structure.

Link to this function

build_v3_plus_request(request_template, opts)

View Source
@spec build_v3_plus_request(map(), Keyword.t()) :: map()

Builds a Heartbeat V3+ request by populating the request template with common fields plus group_instance_id for static membership (KIP-345).

V3 adds group_instance_id: :nullable_string. V4 is the flexible version (KIP-482) with the same logical fields -- Kayrock handles compact encoding.

Link to this function

extract_common_fields(opts)

View Source
@spec extract_common_fields(Keyword.t()) :: %{
  group_id: String.t(),
  member_id: String.t(),
  generation_id: non_neg_integer()
}

Extracts common fields from request options.