Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Make kinesis simple

Project description

Influmy Kinesis

Because we ❤️ sexy docker images. Avoid to add a heavy Java daemon when you are using a KCL language other than Java. So this python package allow you to publish a message in a stream, and consume it with two shard iterator types. LATEST and TRIM_HORIZON

Publisher

Simply import it!

from influmy_kinesis import Publisher

p = Publisher()

p.publish(
	payload={
		'message': 'Hello World',
	},
	stream_name='foo_stream',
	assert_stream=True,
)

By the moment payload should be a JSON serializable dict. With assert_stream to true, if stream does not exist it will be created before put records on it.

Consumer

Eeeeasy!

from influmy_kinesis import Consumer

def callback(records):
	print(records)

c = Consumer(
	stream_name='foo_stream',
	callback_function=callback,
	period=10,
	shard_iterator_type='LATEST',
)

def main():
 loop = asyncio.get_event_loop()
 loop.run_until_complete(
      asyncio.wait(c.consume())
 )
 loop.close()

if __name__ == '__main__':
     main()

With period, in seconds, you define how often consumer gets records. Shard iterator type should be 'LATEST' | 'TRIM_HORIZON'

Credentials

Before you can begin using this outstandable package, you should set up authentication credentials. It uses bot3 so ... Read me 🙄

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 influmy-kinesis, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size influmy_kinesis-0.1.3.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page