Skip to content

Commit f843525

Browse files
committed
changes from review feedback
1 parent d9a8be9 commit f843525

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

examples/asyncio.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# https://www.confluent.io/blog/[path-to-blog-post]
1818

1919
# Example Siege [https://github.com/JoeDog/siege] test:
20-
# siege -c 400 -r 200 'http://localhost:8000/items1 POST {"name":"testuser"}'
20+
# $ siege -c 400 -r 200 'http://localhost:8000/items1 POST {"name":"testuser"}'
2121

2222
import asyncio
2323
import confluent_kafka
@@ -46,6 +46,9 @@ def close(self):
4646
self._poll_thread.join()
4747

4848
def produce(self, topic, value):
49+
"""
50+
An awaitable produce method.
51+
"""
4952
result = self._loop.create_future()
5053

5154
def ack(err, msg):
@@ -57,6 +60,10 @@ def ack(err, msg):
5760
return result
5861

5962
def produce2(self, topic, value, on_delivery):
63+
"""
64+
A produce method in which delivery notifications are made available
65+
via both the returned future and on_delivery callback (if specified).
66+
"""
6067
result = self._loop.create_future()
6168

6269
def ack(err, msg):
@@ -167,4 +174,4 @@ async def create_item5(item: Item):
167174

168175

169176
if __name__ == '__main__':
170-
uvicorn.run(app, host='0.0.0.0', port=8000)
177+
uvicorn.run(app, host='127.0.0.1', port=8000)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy