No project description provided
Project description
仅需一步,轻松实现分布式异步任务。
Brokers
- MemoryBroker
- CronBroker
- WebHookBroker
- RabbitMQBroker
- RedisBroker
- RedisStreamBroker
- RedisPubSubBroker
- KafkaBroker
😋example
# example.py
from onestep import step, WebHookBroker
# 对外提供一个webhook接口,接收外部的消息
@step(from_broker=WebHookBroker(path="/push"))
def waiting_messages(message):
print("收到消息:", message)
if __name__ == '__main__':
step.start(block=True)
also, you can use onestep
command to start, like this:
$ onestep example
then, you can send a message to webhook:
$ curl -X POST -H "Content-Type: application/json" -d '{"a": 1}' http://localhost:8090/push
🤩 other brokers
from onestep import step, CronBroker
# 每3秒触发一次任务
@step(from_broker=CronBroker("* * * * * */3", body={"a": 1}))
def cron_task(message):
assert message.body == {"a": 1}
return message
if __name__ == '__main__':
step.start(block=True)
🤔more examples: examples
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
onestep-0.3.9.tar.gz
(15.4 kB
view details)
Built Distribution
onestep-0.3.9-py3-none-any.whl
(23.2 kB
view details)
File details
Details for the file onestep-0.3.9.tar.gz
.
File metadata
- Download URL: onestep-0.3.9.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1023-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9df8e181648f36159f54d0c1eedfae3c75a5f307daeabfff7f14860b0a3a7d2 |
|
MD5 | 35a61ee6965031e54def0df4d6e912a5 |
|
BLAKE2b-256 | ad831963a07017e778f24635a47d06e12198b9fe697c6ef2c2b7176409aef747 |
File details
Details for the file onestep-0.3.9-py3-none-any.whl
.
File metadata
- Download URL: onestep-0.3.9-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1023-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d65332f8d9a42d28568be68d4fa98b84ca89b166ba70e4dc360d8bb939694b57 |
|
MD5 | 6116911d3d31dcaade8413cb554dbc21 |
|
BLAKE2b-256 | 684f58afde2f6b4a59a3a0dd2cc76b74dfbdf01b76ba93fbdd0105f7ac264318 |