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.81.tar.gz
(15.4 kB
view details)
Built Distribution
onestep-0.3.81-py3-none-any.whl
(23.2 kB
view details)
File details
Details for the file onestep-0.3.81.tar.gz
.
File metadata
- Download URL: onestep-0.3.81.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.13 Linux/6.5.0-1016-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a19b0d3f7253e56d7b8940830c4ac4a7f6858e205820e7b255a03488d446569 |
|
MD5 | bbc39de121e3ec8f0986022d3b7e3544 |
|
BLAKE2b-256 | 34b1f4c1580f0bb18cc87ea7fb386a42604a73d77e93961dffb274f5b97bb9f3 |
File details
Details for the file onestep-0.3.81-py3-none-any.whl
.
File metadata
- Download URL: onestep-0.3.81-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.13 Linux/6.5.0-1016-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dc7f4360378b71aaf9b1c30b5a418e9c778082dbdbd175ac4ed911ca1153307 |
|
MD5 | 36b9443d3541ab6728e3a4ec4d9cf84c |
|
BLAKE2b-256 | 398d4db9ceabfe062fd291c627369ee0ff34f2797736789bfd7e9bda8d7d0c22 |