Skip to main content

Relaybus AMQP subscriber

Project description

relaybus-amqp (Python)

AMQP publisher and subscriber utilities for Relaybus.

Install

pip install relaybus-amqp

Example

Publisher will assert the exchange/queue on first publish (defaults: exchange_type="topic", queue=topic).

from relaybus_amqp import (
    AmqpPublisher,
    AmqpPublisherConnectConfig,
    AmqpSubscriber,
    AmqpSubscriberConnectConfig,
)
from relaybus_core import OutgoingMessage

exchange = "relaybus.events"
queue = "relaybus.demo"

publisher = AmqpPublisher.connect(
    AmqpPublisherConnectConfig(
        url="amqp://guest:guest@localhost:5672/",
        exchange=exchange,
        exchange_type="topic",
        queue=queue,
    )
)
publisher.publish("relaybus.demo", OutgoingMessage(topic="relaybus.demo", payload=b"hello"))
publisher.close()

subscriber = AmqpSubscriber.connect(
    AmqpSubscriberConnectConfig(
        url="amqp://guest:guest@localhost:5672/",
        exchange=exchange,
        queue=queue,
        on_message=lambda msg: print(msg.topic, msg.payload),
    )
)
subscriber.start("relaybus.demo")
subscriber.close()

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

relaybus_amqp-0.0.7.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

relaybus_amqp-0.0.7-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file relaybus_amqp-0.0.7.tar.gz.

File metadata

  • Download URL: relaybus_amqp-0.0.7.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for relaybus_amqp-0.0.7.tar.gz
Algorithm Hash digest
SHA256 96c2680f5cd992ae305a0f4b43bb999b2e0d59d58e269d70228d5ea11735efdc
MD5 29471c01eb24285520275b9ad7d07c5a
BLAKE2b-256 2e6cd5022290c9ab4965e220607a94f195c765cdef7ee84d20b0e4a286bc89a6

See more details on using hashes here.

File details

Details for the file relaybus_amqp-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: relaybus_amqp-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for relaybus_amqp-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a6e3aaee70793f2b4145a616250e0243fe7f7d86c76b26758fbbe45241da3f22
MD5 e66e078680914259e91e7c9e812a7dff
BLAKE2b-256 980ae9c79c66e83956316b8ad05d7aaed6aba96f22d570dc365e4fcfbaa2f9bb

See more details on using hashes here.

Supported by

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