Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mic1on/onestep
Easily implement distributed asynchronous tasks in one step.仅需一步,轻松实现分布式异步任务。
https://github.com/mic1on/onestep
broker cronjob distributed job rabbitmq redis task webhook
Last synced: 20 days ago
JSON representation
Easily implement distributed asynchronous tasks in one step.仅需一步,轻松实现分布式异步任务。
- Host: GitHub
- URL: https://github.com/mic1on/onestep
- Owner: mic1on
- Created: 2023-03-24T06:35:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-26T15:51:14.000Z (4 months ago)
- Last Synced: 2024-10-12T18:58:32.355Z (about 1 month ago)
- Topics: broker, cronjob, distributed, job, rabbitmq, redis, task, webhook
- Language: Python
- Homepage: https://onestep.code05.com/
- Size: 1.71 MB
- Stars: 20
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
仅需一步,轻松实现分布式异步任务。## Brokers
- [x] MemoryBroker
- [x] CronBroker
- [x] WebHookBroker
- [x] RabbitMQBroker
- [x] RedisBroker
- [x] RedisStreamBroker
- [x] RedisPubSubBroker
- [ ] KafkaBroker## 😋example
```python
# example.pyfrom 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:
```bash
$ onestep example
```then, you can send a message to webhook:
```bash
$ curl -X POST -H "Content-Type: application/json" -d '{"a": 1}' http://localhost:8090/push
```## 🤩 other brokers
```python
from onestep import step, CronBroker# 每3秒触发一次任务
@step(from_broker=CronBroker("* * * * * */3", body={"a": 1}))
def cron_task(message):
assert message.body == {"a": 1}
return messageif __name__ == '__main__':
step.start(block=True)
```🤔more examples: [examples](example)