Skip to content

Himenon/hakka-py

Repository files navigation

hakka-py

Documentation Status Updates

Small Task Queue

Usage

$ pip install hakka

Worker

from hakka import Hakka

app = Hakka()

@app.watch('hello:msg')
def hello_msg(name=None, msg=None, **kwargs):
    print("Hello {name}!, {msg}".format(name=name, msg=msg))

app.listen('localhost', 6379, 0, debug=True)

Sender

from hakka import HakkaRedisClient

if __name__ == '__main__':
    client = HakkaRedisClient()

    message = {
        "name": "hakka",
        "reading": "books"
    }
    for i in range(10):
        message.update({
            "msg": "Hello World x {}!".format(i),
        })
        client.set_value('hello:msg', message)
$ redis-cli lpush hello:msg '{"name": "yourname", "msg": "Congratulation!"}'

How to Develop

Using: Docker, docker-compose

$ docker-compose up
# start pytest-watch