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

Shared utility functions for building FindCoordinator requests.

Summary

Functions

Builds a V1+ request by extracting coordinator key and type from options.

Extracts and normalizes coordinator type from options.

Extracts the group_id from options for V0 requests.

Extracts coordinator key and type from options for V1 requests.

Functions

Link to this function

build_v1_plus_request(request, opts)

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

Builds a V1+ request by extracting coordinator key and type from options.

Works for V1, V2, V3, and any future version with key + key_type fields.

Link to this function

extract_coordinator_type(opts)

View Source
@spec extract_coordinator_type(Keyword.t()) :: 0 | 1

Extracts and normalizes coordinator type from options.

Accepts:

  • Integer: 0 or 1
  • Atom: :group or :transaction

Returns integer (0 or 1).

@spec extract_group_id(Keyword.t()) :: binary()

Extracts the group_id from options for V0 requests.

@spec extract_v1_fields(Keyword.t()) :: {binary(), 0 | 1}

Extracts coordinator key and type from options for V1 requests.

Returns {coordinator_key, coordinator_type} where:

  • coordinator_key is the group_id or transactional_id
  • coordinator_type is 0 (group) or 1 (transaction)