Skip to main content

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


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

Uploaded Source

Built Distribution

onestep-0.3.6-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for onestep-0.3.6.tar.gz
Algorithm Hash digest
SHA256 244280891c9bf5e54ea8fa257e76430b96a023b30a29bdf3d310e7ac9ce3dedf
MD5 a55b92836f6afdc8f6b218fa74b22a2b
BLAKE2b-256 cb51c2a19ffb4acd2db163d4d65d465dc0a221eb0aa22c884d03864a83f241b5

See more details on using hashes here.

File details

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

File metadata

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

Hashes for onestep-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bed54f6ef0eb4a09b5bd8bba759e51035d1d53365f5dc2b2949e021b2a173797
MD5 0317d8d061445a72d2e1aa63e5293534
BLAKE2b-256 3815bc4e1d1dac1a9e9fd180678f8378e00893d19dc902f2aa9de0184bbe7c0d

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