Skip to main content

RocketMQ Python client

Project description

rocketmq-python

Build Status PyPI

RocketMQ Python client

Installation

pip install rocketmq

Usage

Producer

from rocketmq.client import Producer, Message

producer = Producer('PID-XXX')
producer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')
producer.set_session_credentials('XXX', 'XXXX', 'ALIYUN')
producer.start()

msg = Message('YOUR-TOPIC')
msg.set_keys('XXX')
msg.set_tags('XXX')
msg.set_body('XXXX')
ret = producer.send_sync(msg)
print(ret.status, ret.msg_id, ret.offset)
producer.shutdown()

PushConsumer

import time

from rocketmq.client import PushConsumer


def callback(msg):
    print(msg.id, msg.body)


consumer = PushConsumer('CID_XXX')
consumer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')
consumer.set_session_credentials('XXX', 'XXXX', 'ALIYUN')
consumer.subscribe('YOUR-TOPIC', callback)
consumer.start()

while True:
    time.sleep(3600)

consumer.shutdown()

PullConsumer

from rocketmq.client import PullConsumer


consumer = PullConsumer('CID_XXX')
consumer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')
consumer.set_session_credentials('XXX', 'XXXX', 'ALIYUN')
consumer.start()

for msg in consumer.pull('YOUR-TOPIC'):
    print(msg.id, msg.body)

consumer.shutdown()

License

This work is released under the MIT license. A copy of the license is provided in the LICENSE file.

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

rocketmq-0.3.2.tar.gz (1.0 MB view details)

Uploaded Source

Built Distributions

rocketmq-0.3.2-py2.py3-none-manylinux1_x86_64.whl (1.2 MB view details)

Uploaded Python 2 Python 3

rocketmq-0.3.2-py2.py3-none-macosx_10_13_x86_64.whl (1.0 MB view details)

Uploaded Python 2 Python 3 macOS 10.13+ x86-64

File details

Details for the file rocketmq-0.3.2.tar.gz.

File metadata

  • Download URL: rocketmq-0.3.2.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/2.7.15

File hashes

Hashes for rocketmq-0.3.2.tar.gz
Algorithm Hash digest
SHA256 0f495d2cb6d650d07ad0f2b78a4c0c3ac5482615faedf9fb4db368da084b947b
MD5 f0e15c8e2b13df823a70b5eccb3f0efc
BLAKE2b-256 fc1c0ad4715ca1009468307b3637f012f587df668043a99146da547d12a0a3c3

See more details on using hashes here.

File details

Details for the file rocketmq-0.3.2-py2.py3-none-manylinux1_x86_64.whl.

File metadata

  • Download URL: rocketmq-0.3.2-py2.py3-none-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/2.7.6

File hashes

Hashes for rocketmq-0.3.2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d11e7de974578cc0908497881a9696ec9c9d8627c20b4c7948a19375773b570c
MD5 3268221aa0f5ad087b3f1c87aebf186b
BLAKE2b-256 2bc1026c7ef4ee4e1bda2ef3829364c368df4e1c7b946f47461215af5a0d1cfa

See more details on using hashes here.

File details

Details for the file rocketmq-0.3.2-py2.py3-none-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: rocketmq-0.3.2-py2.py3-none-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 2, Python 3, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/2.7.15

File hashes

Hashes for rocketmq-0.3.2-py2.py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 25e6d53ef195b1d8893472713cd29df5cd89b346b805876451839784d3201436
MD5 d8319c1c806d2adcb73edf13be825cf9
BLAKE2b-256 97999c19fc70f607da3e3f3bd0148302a2645421783af089a53fb2ad1036ac3b

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