Small Task Queue
- Free software: MIT license
- Documentation: <https://hakka.readthedocs.io>.
$ 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!"}'
Using: Docker, docker-compose
$ docker-compose up
# start pytest-watch