Kiel: Kafka Tornado Client

Kiel is a pure python Kafka client library for use with Tornado applications, built with ease-of-use in mind.

There are three client classes available:

Installation

Pip

Kiel is available via PyPI, installation is as easy as:

pip install kiel

Manual

To install manually, first download and unzip the kiel-0.9.4-dev.tar.gz, then:

tar -zxvf kiel-0.9.4-dev.tar.gz
cd kiel-0.9.4-dev
python setup.py install

Examples

Example scripts can be found in the examples directory in the repo.

Quick Consumer Example

from kiel import clients
from tornado import gen, ioloop


@gen.coroutine
def consume():
    c = clients.SingleConsumer(brokers=["localhost"])

    yield c.connect()

    while True:
        msgs = yield c.consume("examples.colors")
        for msg in msgs:
            print(msg["color"])


def run():
    loop = ioloop.IOloop.instance()

    loop.add_callback(consume)

    try:
        loop.start()
    except KeyboardInterrupt:
        loop.stop()

Development

The code is hosted on GitHub

To file a bug or possible enhancement see the Issue Tracker, also found on GitHub.

License

Kiel is licensed under the terms of the Apache License (2.0). See the LICENSE file for more details.