Skip to main content

A simple rpc client/server library

Project description

简述

这是对 RabbitMQ 的 Pika 库进行封装的,一套简易 RPC 客户端/服务端库。

安装说明

pip install rabbit-rpc

使用事例

服务端

# project/consumers.py

from rabbit_rpc.consumer import consumer

@consumer(name='add')
def add(a, b):
    return a + b


# project shell
rabbit_rpc worker --amqp 'amqp://guest:guest@localhost:5672/'


# with django

rabbit_rpc worker --amqp 'amqp://guest:guest@localhost:5672/' --django

客户端

from rabbit_rpc.client import RPCClient

client = RPCClient(amqp_url='amqp://guest:guest@localhost:5672/')
ret = client.call_add(1, 1, timeout=1)

# or ignore result
client.call_add(1, 1, ignore_result=True)

# specify routing_key
client.call_add(1, 1, routing_key='default')

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

rabbit_rpc-0.0.2-py2-none-any.whl (11.6 kB view details)

Uploaded Python 2

File details

Details for the file rabbit_rpc-0.0.2-py2-none-any.whl.

File metadata

File hashes

Hashes for rabbit_rpc-0.0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 9d4a70ec4144f0e6a19865f31d0912131d8fb79dfadfdfe3adfd9bc81e61835a
MD5 5bf544c6ade23ce338d7d6e3963862af
BLAKE2b-256 7983786bf036288e349329577dc40c316f52eda416e83e0229e1e17f71bc2460

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page