KafkaEx.Partitioner behaviour (kafka_ex v0.12.1) View Source

Behaviour definition for partitioners, that assigns partitions for requests.

Link to this section Summary

Functions

Returns key for given messages

Link to this section Functions

Specs

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.

Link to this section Callbacks

Link to this callback

assign_partition(request, metadata)

View Source

Specs

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()
}