异步运动客户端
aiokinesis的Python项目详细描述
br/>循环=asyncio.get_event_loop()
producer=aiokineisproducer('my-stream-name',loop,region_name='us-east-1')
等待producer.start()
等待producer.send('partition-key',,{'data':'blah'})
await asyncio.sleep(1)
await producer.stop()
loop.run廑until廑complete(send廑message())
````
限制:
-在发送所有消息之前停止生产者将阻止发送飞行中的消息
-aiokiness只支持一个shard,因此生产者的速率限制为5每滚动秒请求数
aiokinessconsumer
----
用法:
``python
import asyncio
from aiokinesis import aiokinessconsumer
async def get_messages():
loop=asyncio.get_event_loop()
consumer=aiokinessconsumer('my-stream-name',loop,region_name='us-east-1')
等待使用者。start()
尝试:
对使用者中的消息进行异步:
打印(“已使用的消息:”,消息)
除了键盘中断:
等待使用者。stop()
循环。run_until_complete()
````
限制:
-调用过程只支持一个碎片,因此使用者的速率限制为每滚动秒5个请求