Shopify/sarama — pull request #169 by eapache (2014-11-01 17:06:51+00:00)
Title: Partitioner-ng

@wvanbergen PRing this into the producer-ng branch because last-minute API changes are fun and I wanted your opinion.

Both master and producer-ng right now share a single partitioner (guarded by a mutex) across all topics being produced to. This is broken if e.g. you use RoundRobin and alternate producing to two topics: one topic will always end up on odd partitions, the other on even partitions, because they'll share the state in the RoundRobinPartitioner.

So the changes in this branch:
- define a `PartitionerConstructor` type (function) and have config take that instead
- for every topic in producer-ng, construct a new partitioner exclusive to that topic
- get rid of the now-unnecessary mutexes in the partitioners
- switch default from random to hash partitioner because it's more useful and to more closely match the scala version