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.9.tar.gz (5.1 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.9-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: relaybus_amqp-0.0.9.tar.gz
  • Upload date:
  • Size: 5.1 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.9.tar.gz
Algorithm Hash digest
SHA256 2507ae1587e60a935f8e3a7df1ce111e73b2e34d99055787da4cdce839cf3d7e
MD5 42e947d53811f09df0adef49ec542d80
BLAKE2b-256 4d4eb30a8965c06a5d34b485d281e4dae367d013cc8c8ad025a1704da78bfe55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: relaybus_amqp-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 5.4 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 fcd44172abc4efe292cd9a4788d79b1274ace225c164801fe1a3dff1cd93e780
MD5 2965eba531d8a53597293c2c1f1c63ca
BLAKE2b-256 49fbd9f5438369cea16cb394229982e8d72d5e742c3e96e5f5b91ab042bfff30

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