Created
November 22, 2016 16:26
-
-
Save DXist/1a6e62d015bbbb3697d16910ff83d231 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) | |
producer.flush() | |
print('produced') | |
# blocks | |
msg = next(consumer) | |
print('consumed', msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment