From 16cc23cc1f669fa9e18ac9477e356a6b50fe13d5 Mon Sep 17 00:00:00 2001 From: Taras Date: Fri, 15 Apr 2016 16:07:37 +0300 Subject: [PATCH 1/2] Added some simplest examples. --- examples/simple_consumer.py | 17 +++++++++++++++++ examples/simple_produce.py | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 examples/simple_consumer.py create mode 100644 examples/simple_produce.py diff --git a/examples/simple_consumer.py b/examples/simple_consumer.py new file mode 100644 index 00000000..07f10b61 --- /dev/null +++ b/examples/simple_consumer.py @@ -0,0 +1,17 @@ +from aiokafka import AIOKafkaConsumer +import asyncio + +loop = asyncio.get_event_loop() + +async def consume(): + consumer = AIOKafkaConsumer( + "my_topic", loop=loop, bootstrap_servers='localhost:9092') + # Get cluster layout and topic/partition allocation + await consumer.start() + try: + async for msg in consumer: + print(msg.value) + finally: + await consumer.stop() + +loop.run_until_complete(consume()) diff --git a/examples/simple_produce.py b/examples/simple_produce.py new file mode 100644 index 00000000..22324f02 --- /dev/null +++ b/examples/simple_produce.py @@ -0,0 +1,17 @@ +from aiokafka import AIOKafkaProducer +import asyncio + +loop = asyncio.get_event_loop() + +async def send_one(): + producer = AIOKafkaProducer( + loop=loop, bootstrap_servers='localhost:9092') + # Get cluster layout and topic/partition allocation + await producer.start() + try: + # Produce messages + await producer.send_and_wait("my_topic", b"Super message") + finally: + await producer.stop() + +loop.run_until_complete(send_one()) From fe08bdbc92f32f9b490b895b0a7ecfd897c6df8b Mon Sep 17 00:00:00 2001 From: Taras Date: Fri, 15 Apr 2016 17:00:47 +0300 Subject: [PATCH 2/2] Bumpversion 0.1.0 -> 0.1.1. Fixed packaging issues. --- CHANGES.rst | 5 +++++ aiokafka/__init__.py | 2 +- tests/test_client.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 139591c7..8a657b6e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,11 @@ CHANGES -------- +0.1.1 (2016-04-15) +^^^^^^^^^^^^^^^^^^ + +* Fix packaging issues. Removed unneded files from package. + 0.1.0 (2016-04-15) ^^^^^^^^^^^^^^^^^^ diff --git a/aiokafka/__init__.py b/aiokafka/__init__.py index 541005d5..42451849 100644 --- a/aiokafka/__init__.py +++ b/aiokafka/__init__.py @@ -6,7 +6,7 @@ import sys # noqa PY_35 = sys.version_info >= (3, 5) -__version__ = '0.1.0' +__version__ = '0.1.1' from .client import AIOKafkaClient # noqa from .producer import AIOKafkaProducer # noqa diff --git a/tests/test_client.py b/tests/test_client.py index 969e0c1f..10942058 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -26,7 +26,7 @@ def test_init_with_list(self): loop=self.loop, bootstrap_servers=['kafka01:9092', 'kafka02:9092', 'kafka03:9092']) self.assertEqual( - '', client.__repr__()) + '', client.__repr__()) self.assertEqual(sorted({'kafka01': 9092, 'kafka02': 9092, 'kafka03': 9092}.items()),