summaryrefslogtreecommitdiff
path: root/kafka/producer/keyed.py
diff options
context:
space:
mode:
Diffstat (limited to 'kafka/producer/keyed.py')
-rw-r--r--kafka/producer/keyed.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/kafka/producer/keyed.py b/kafka/producer/keyed.py
index 333b6c0..bc42803 100644
--- a/kafka/producer/keyed.py
+++ b/kafka/producer/keyed.py
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import logging
+import warnings
from kafka.partitioner import HashedPartitioner
from kafka.util import kafka_bytestring
@@ -58,15 +59,15 @@ class KeyedProducer(Producer):
partitioner = self.partitioners[topic]
return partitioner.partition(key)
- def send_messages(self,topic,key,*msg):
+ def send_messages(self, topic, key, *msg):
topic = kafka_bytestring(topic)
partition = self._next_partition(topic, key)
- return self._send_messages(topic, partition, *msg,key=key)
+ return self._send_messages(topic, partition, *msg, key=key)
+ # DEPRECATED
def send(self, topic, key, msg):
- topic = kafka_bytestring(topic)
- partition = self._next_partition(topic, key)
- return self._send_messages(topic, partition, msg, key=key)
+ warnings.warn("KeyedProducer.send is deprecated in favor of send_messages", DeprecationWarning)
+ return self.send_messages(topic, key, msg)
def __repr__(self):
return '<KeyedProducer batch=%s>' % self.async