View Source KafkaEx.LegacyPartitioner (kafka_ex v0.13.0)

Legacy default partitioner implementation.

This "legacy partitioner" used to be the default partitioner for KafkaEx when a message key is set and a partition isn't. This was intended to match the behaviour of the default Java client, however there was some small differences. This legacy partitioner keeps the previous behaviour, and the current default partitioner now correctly matches the Java client.

Link to this section Summary

Link to this section Functions

Link to this function

assign_partition(request, metadata)

View Source
@spec 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()
}

Callback implementation for KafkaEx.Partitioner.assign_partition/2.