Skip to main content

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


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.4.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

onestep-0.4.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file onestep-0.4.0.tar.gz.

File metadata

  • Download URL: onestep-0.4.0.tar.gz
  • Upload date:
  • Size: 15.5 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

Hashes for onestep-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f537deb9a493f47c937de2dba747a373904a9b0912297c6cd63afde31ffcc92f
MD5 07ecb405ab13050038c10721c4ad413c
BLAKE2b-256 98bb8089847f2ce7e5b71f4cc19ea55385bdda5d1e4de9dd75cbb3dd44dfc48c

See more details on using hashes here.

File details

Details for the file onestep-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: onestep-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 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

Hashes for onestep-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0fcf67de1badf6c16870ce5eaecff664ea5f293ebf7bcc21d35bb70a95583c4
MD5 2cfc86e928c59c620ff48c905b86ab77
BLAKE2b-256 ac30c787f2be0f526124f9120ee0e3568d97f2b84297a7aa6c4390d9d301d4f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page