summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/index.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 6ce228a..d8f826a 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -58,7 +58,7 @@ that expose basic message attributes: topic, partition, offset, key, and value:
>>> msg = next(consumer)
>>> # Deserialize msgpack-encoded values
->>> consumer = KafkaConsumer(value_deserializer=msgpack.dumps)
+>>> consumer = KafkaConsumer(value_deserializer=msgpack.loads)
>>> consumer.subscribe(['msgpackfoo'])
>>> for msg in consumer:
... msg = next(consumer)
@@ -84,7 +84,7 @@ client. See `KafkaProducer <apidoc/KafkaProducer.html>`_ for more details.
>>> # Serialize json messages
>>> import json
->>> producer = KafkaProducer(value_serializer=json.loads)
+>>> producer = KafkaProducer(value_serializer=lambda v: json.dumps(v).encode('utf-8'))
>>> producer.send('fizzbuzz', {'foo': 'bar'})
>>> # Serialize string keys