View Source KafkaEx.Auth.SASL.Codec behaviour (kafka_ex v0.15.0)
Behaviour defining the codec interface for SASL protocol messages.
Implementations must handle:
- Building request frames (API versions, handshake, authenticate)
- Parsing response frames with correlation ID validation
- Selecting optimal protocol versions based on broker capabilities
This abstraction allows for different encoding strategies while maintaining a consistent interface for the SASL authentication flow.
Summary
Types
@type error() :: {:error, term()}
Callbacks
@callback parse_api_versions_response(data :: binary(), expected_corr :: integer()) :: api_versions_map() | error()
@callback pick_authenticate_version(api_versions :: api_versions_map() | error()) :: non_neg_integer()
@callback pick_handshake_version(api_versions :: api_versions_map() | error()) :: non_neg_integer()