View Source KafkaEx.Partitioner behaviour (kafka_ex v0.13.0)
Behaviour definition for partitioners, that assigns partitions for requests.
Link to this section Summary
Functions
Returns key for given messages
Link to this section Callbacks
@callback assign_partition( request :: %KafkaEx.Protocol.Produce.Request{ api_version: term(), compression: term(), messages: term(), partition: term(), required_acks: term(), timeout: term(), topic: term() }, metadata :: %KafkaEx.Protocol.Metadata.Response{ brokers: term(), controller_id: term(), topic_metadatas: term() } ) :: %KafkaEx.Protocol.Produce.Request{ api_version: term(), compression: term(), messages: term(), partition: term(), required_acks: term(), timeout: term(), topic: term() }
Link to this section Functions
@spec get_key( request :: %KafkaEx.Protocol.Produce.Request{ api_version: term(), compression: term(), messages: term(), partition: term(), required_acks: term(), timeout: term(), topic: term() } ) :: {:ok, nil | binary()} | {:error, atom()}
Returns key for given messages
Function looks for message key in messages list of {ProduceRequest}. It may return
either {:ok, nil}
if no key was found, {:ok, key}
when key was found,
or {:error, atom}
when error happens while looking for the key.