Skip to main content

仅需一步,轻松实现分布式异步任务。

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

Uploaded Source

Built Distribution

onestep-0.4.2-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: onestep-0.4.2.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.0 CPython/3.10.16 Linux/6.8.0-1021-azure

File hashes

Hashes for onestep-0.4.2.tar.gz
Algorithm Hash digest
SHA256 4fcfa53492e87f8e91e23f542a3456c4d18628037c3e22e7fb950ee1a50b491a
MD5 f07fd87fc97dc2b28403dadfc4c10396
BLAKE2b-256 ed9bac956ba2c13956b0b05710b7d382287935e3828d85434a91a34da08a468c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onestep-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.0 CPython/3.10.16 Linux/6.8.0-1021-azure

File hashes

Hashes for onestep-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad98d0610e6582cce295b43513c548afb696e90135cf5a0ccf63c4f5b2ef46de
MD5 0cb8579b97be9f586c778f4b26b170d4
BLAKE2b-256 e8ecf022a7da3c4997bc12cf58b6714d54dbdd4c8d5742e519308256f909af9c

See more details on using hashes here.

Supported by

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