Skip to main content

Asyncio kinesis client

Project description


Asyncio client library for AWS Kinesis

pip install aiokinesis

import asycio
from aiokinesis import AIOKinesisProducer

async def send_message():
loop = asyncio.get_event_loop()
producer = AIOKinesisProducer('my-stream-name', loop, region_name='us-east-1')
await producer.start()

await producer.send('partition-key', {'data': 'blah'})

await asyncio.sleep(1)
await producer.stop()

- Stopping the producer before all messages are sent will prevent in flight messages from being sent
- AIOKinesis only supports one shard so the producer is rate limited to 5 requests per rolling second

import asyncio
from aiokinesis import AIOKinesisConsumer

async def get_messages():
loop = asyncio.get_event_loop()
consumer = AIOKinesisConsumer('my-stream-name', loop, region_name='us-east-1')
await consumer.start()

async for message in consumer:
print("Consumed message: ", message)
except KeyboardInterrupt:
await consumer.stop()

- AIOKinesis only supports one shard so the consumer is rate limited to 5 requests per rolling second

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aiokinesis, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size aiokinesis-0.0.4-py3-none-any.whl (4.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aiokinesis-0.0.4.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page