Created
November 23, 2016 13:21
-
-
Save DXist/4ad6fcac026d0067a3a56dd3b92a4b09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
"""Test message logging end to end.""" | |
from __future__ import ( | |
absolute_import, division, print_function, unicode_literals | |
) | |
from kafka import KafkaConsumer, KafkaProducer | |
def test_kafka_pass_through(): | |
consumer = KafkaConsumer(bootstrap_servers=['127.0.0.1:9092']) | |
consumer.subscribe(['test_topic']) | |
producer = KafkaProducer(bootstrap_servers=['127.0.0.1:9092']) | |
future = producer.send('test_topic', b'some_message_bytes') | |
future.get(timeout=10) | |
print('produced') | |
# blocks | |
msg = next(consumer) | |
print(msg) | |
consumer.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment