Skip to main content

amqpconsumer

A Python module to facilitate listening for and acting on AMQP events.

Usage

Example:

import logging

from amqpconsumer.events import EventConsumer


def handler(event):
    print("Got event:", event)


def main():
    logging.basicConfig(level=logging.INFO)
    consumer = EventConsumer('amqp://guest:guest@localhost:5672/%2f',
                             'testqueue',
                             handler)
    try:
        consumer.run()
    except KeyboardInterrupt:
        consumer.stop()


if __name__ == '__main__':
    main()

Tracing

For every consumed message the consumer extracts OpenTelemetry trace context from the AMQP message headers and wraps the handler call in a consumer span, continuing the publisher’s trace when the message carries one (messages without trace headers simply start a trace of their own). This only depends on opentelemetry-api, for applications without a configured OpenTelemetry backend all tracing calls are no-ops and the behaviour is unchanged. To get the spans into your tracing backend, configure an OpenTelemetry SDK in your application (for example by enabling the Sentry SDK’s OpenTelemetry support).

Running tests

Install uv and run uv run pytest tests.

About

This software is brought to you by Byte, a webhosting provider based in Amsterdam, The Netherlands. We specialize in fast and secure Magento hosting and scalable cluster hosting.

Check out our Github page for more open source software or our site to learn about our products and technologies. Look interesting? Reach out about joining the team. Or just drop by for a cup of excellent coffee if you’re in town!

Download files

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

Source Distribution

amqpconsumer-1.8.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

amqpconsumer-1.8.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file amqpconsumer-1.8.1.tar.gz.

File metadata

  • Download URL: amqpconsumer-1.8.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for amqpconsumer-1.8.1.tar.gz
Algorithm Hash digest
SHA256 968d6e8c0e29779e5d742a6c8d57219850b434d86ad9ca926670a388ff3979b6
MD5 83c62ea0dd616b95484fb9439d963668
BLAKE2b-256 d74f77911f8898f88bca11e0e0818c7a0c4dad73a0cf0bd511aa3e71d3da85bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for amqpconsumer-1.8.1.tar.gz:

Publisher: pypi-publish.yml on ByteInternet/amqpconsumer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file amqpconsumer-1.8.1-py3-none-any.whl.

File metadata

  • Download URL: amqpconsumer-1.8.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for amqpconsumer-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5a622cea981a74b11f2252bead403e47fd3d9cd211442e13401b58982baa869
MD5 3ecf063f5d20f04b5c70c033419edcbc
BLAKE2b-256 1707ec02f3677d470375044976ee7a2ec2aaec00d9ad0216fd15863e4985369e

See more details on using hashes here.

Provenance

The following attestation bundles were made for amqpconsumer-1.8.1-py3-none-any.whl:

Publisher: pypi-publish.yml on ByteInternet/amqpconsumer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.8.1 This release

2 files

1.7.4

1 file

1.7.3

1 file

1.7.2

1 file

1.7.1

1 file

1.7

1 file

1.6

1 file

1.5

1 file

1.4

1 file

1.3

1 file

1.1

1 file

1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page