Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Sparrow task sender

Project description

Sparrow Task Sender

Introduction

Sparrow task sender is a RabbitMQ (AMQP 0-9-1) producer side library for Python. Specially designed for sparrow project.

  • Python 3.5+ are supported.

Installation

add sparrow-task-sender==0.0.x in requirements.txt, 0.0.x should be the latest version

pip install sparrow_task_sender

Example

Here is the most simple example of use

# 发送非延时任务
from task_sender import TaskSender
# 接收消息的api地址
message_backend = "sparrow-task-test-svc:8001/api/sparrow_task/producer/send/"
task_sender = TaskSender(message_backend)
task_sender.send_task(
	exchange=exchange,
	routing_key=routing_key,
	message_code=message_code,
	*args,
	**kwargs
)

# 发送延时任务
from task_sender import TaskSender
# 接收消息的api地址
message_backend = "sparrow-task-test-svc:8001/api/sparrow_task/producer/send/"
task_sender = TaskSender(message_backend)
task_sender.send_delayed_task(
	exchange=exchange,
	routing_key=routing_key,
	message_code=message_code,
	delay=delay,
	delay_time=delay_time,
	*args,
	**kwargs
)

注: args和kwargs为执行任务时需要的变量

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sparrow-task-sender, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size sparrow_task_sender-0.0.4-py3-none-any.whl (4.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size sparrow_task_sender-0.0.4.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page