{"id":4874,"library":"amqpstorm","title":"AMQPStorm","description":"AMQPStorm is a thread-safe Python client library for RabbitMQ, offering comprehensive features for both messaging and RabbitMQ management. Currently at version 2.11.1, the library maintains an active release cadence with regular updates and improvements, ensuring stability and compatibility.","status":"active","version":"2.11.1","language":"en","source_language":"en","source_url":"https://github.com/eandersson/amqpstorm","tags":["rabbitmq","amqp","messaging","client","management","broker"],"install":[{"cmd":"pip install amqpstorm","lang":"bash","label":"Core library"},{"cmd":"pip install amqpstorm[management]","lang":"bash","label":"With Management API features"},{"cmd":"pip install amqpstorm[pool]","lang":"bash","label":"With connection pooling features"}],"dependencies":[{"reason":"Required for the Management API functionality.","package":"requests","optional":true},{"reason":"Required for the connection pooling features.","package":"amqpstorm-pool","optional":true},{"reason":"Underlying AMQP 0-9-1 frame marshalling library (core dependency, usually installed automatically).","package":"pamqp","optional":false}],"imports":[{"symbol":"Connection","correct":"from amqpstorm import Connection"},{"symbol":"UriConnection","correct":"from amqpstorm import UriConnection"},{"symbol":"Message","correct":"from amqpstorm import Message"},{"note":"Provides access to the Management API classes like ManagementApi.","symbol":"management","correct":"from amqpstorm import management"}],"quickstart":{"code":"import amqpstorm\nimport os\n\nRABBITMQ_HOST = os.environ.get('RABBITMQ_HOST', 'localhost')\nRABBITMQ_USER = os.environ.get('RABBITMQ_USER', 'guest')\nRABBITMQ_PASS = os.environ.get('RABBITMQ_PASS', 'guest')\n\ntry:\n    # Establish a connection using a context manager for proper resource handling\n    with amqpstorm.Connection(RABBITMQ_HOST, RABBITMQ_USER, RABBITMQ_PASS) as connection:\n        # Open a channel using a context manager\n        with connection.channel() as channel:\n            # Declare a queue (idempotent operation)\n            channel.queue.declare('my_queue')\n\n            # Publish a simple message to 'my_queue'\n            channel.basic.publish(body='Hello, RabbitMQ!', routing_key='my_queue')\n            print(\" [x] Sent 'Hello, RabbitMQ!'\")\nexcept amqpstorm.AMQPConnectionError as e:\n    print(f\"Error connecting to RabbitMQ: {e}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to establish a connection to RabbitMQ, open a channel, declare a queue, and publish a basic message using AMQPStorm. It uses environment variables for connection details and context managers for robust resource management."},"warnings":[{"fix":"Update consumer logic to expect and interact with `amqpstorm.Message` objects. Access message content via `message.body` and properties via `message.properties` or `message.get_property('key')`. If necessary, explicitly set `to_tuple=True` or `to_dict=True` when consuming, but using `Message` objects is recommended.","message":"Starting with version 2.0.0, messages are delivered as `Message` objects by default. Previous versions might have returned tuples or dictionaries directly from consumer functions.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"If encountering `Import Error` related to `pamqp`, consider pinning your `pamqp` version to `<3.0.0` or checking the AMQPStorm GitHub issues for a resolution or newer AMQPStorm version that addresses this compatibility. `pip install 'pamqp<3.0.0'`","message":"There's an open issue (#144) regarding `Import Error due to API Change in pamqp>=3.0.0 (specification -> commands)`, which is a core dependency. This might cause issues with newer `pamqp` versions.","severity":"gotcha","affected_versions":">=2.11.0 with pamqp>=3.0.0"},{"fix":"While this is an internal library usage, be aware that warnings might appear in Python 3.12+ environments. Keep an eye on AMQPStorm updates for a fix. No direct user-level fix is available, but it's generally harmless beyond the warning.","message":"The library's `amqpstorm/message.py` currently uses `datetime.utcnow()`, which is deprecated in Python 3.12+ in favor of `datetime.now(timezone.utc)`. This is an open issue (#143).","severity":"deprecated","affected_versions":"Python 3.12+"},{"fix":"Always use `with` statements (context managers) for `Connection` and `Channel` objects, as shown in the quickstart. This ensures resources are automatically released, even if errors occur. Explicitly call `connection.close()` and `channel.close()` if context managers are not used.","message":"Properly closing connections and channels is crucial to avoid resource leaks or hangs, especially in long-running applications or when handling errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Carefully configure `ssl_options` and `verify`. For production, always use `verify=True` (or provide a path to a CA bundle) and ensure `server_hostname` is correctly set. Only use `verify=False` for testing purposes where the risk is understood and mitigated.","message":"When using SSL/TLS connections, incorrect `ssl_options` or `verify` parameter settings can lead to insecure connections (e.g., no certificate verification) or failed connections (e.g., incorrect CA bundles).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}