ruby-kafka
https://github.com/zendesk/ruby-kafka
Ruby
A Ruby client library for Apache Kafka
Kafka::Partitioner.partition_for_key
Assigns a partition number based on a partition key. If no explicit partition key is provided, the message key will be used instead. If the key is nil, then a random partition is selected. Otherwise, a digest of the key is used to deterministically find a partition. As long as the number of partitions doesn't change, the same key will always be assigned to the same partition.
Edit
git clone [email protected]:zendesk/ruby-kafka.git
cd ruby-kafka
open lib/kafka/partitioner.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Kafka--Partitioner-partition_for_key-for-pr
# Commit to gitgit add lib/kafka/partitioner.rbgit commit -m "better docs for Kafka::Partitioner.partition_for_key"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Kafka--Partitioner-partition_for_key-for-pr
hub pull-request
# Celebrate!