No project description provided
Project description
仅需一步,轻松实现分布式异步任务。
Brokers
- MemoryBroker
- CronBroker
- WebHookBroker
- RabbitMQBroker
- RedisBroker
- 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.7.tar.gz
(15.1 kB
view details)
Built Distribution
onestep-0.3.7-py3-none-any.whl
(22.6 kB
view details)
File details
Details for the file onestep-0.3.7.tar.gz
.
File metadata
- Download URL: onestep-0.3.7.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1016-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21216379d709a0a4030724d0bc1278abe08ea6ab6069f8ab544315fb30f87d78 |
|
MD5 | 43bed3c5c05ce303c79f97720e1d9b50 |
|
BLAKE2b-256 | da5dd29979c7862ca1e243fb9d87f55e22eacd0232dc7820c286741ebea548b1 |
File details
Details for the file onestep-0.3.7-py3-none-any.whl
.
File metadata
- Download URL: onestep-0.3.7-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1016-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65c3fc82c47b6104dd72a35a4ce6d32d5285a113276aa1f4d3f6adc594f21008 |
|
MD5 | f3e6a838ceeb0e38cb5b296187a07d69 |
|
BLAKE2b-256 | 8145715fdbb8ac62547424c50d3e7d00479ab5b5525b76c7c1441d68fb3390e7 |