{"id":2346,"library":"uamqp","title":"AMQP 1.0 Client Library for Python","description":"uAMQP is an AMQP 1.0 Client Library for Python, serving as a C-extension wrapper around the Azure uAMQP C library. It provides low-level AMQP protocol implementation. The current version is 1.6.11. As of v1.6.5, the library is in maintenance mode, with major Azure SDKs (Event Hubs, Service Bus) now utilizing a pure Python AMQP library for new development.","status":"maintenance","version":"1.6.11","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-uamqp-python","tags":["amqp","azure","messaging","c-extension"],"install":[{"cmd":"pip install uamqp","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"Connection","correct":"from uamqp import Connection"},{"symbol":"Message","correct":"from uamqp import Message"},{"symbol":"SenderLink","correct":"from uamqp import SenderLink"},{"symbol":"ReceiverLink","correct":"from uamqp import ReceiverLink"},{"symbol":"authentication","correct":"from uamqp import authentication"}],"quickstart":{"code":"import os\nimport time\nimport uamqp\nfrom uamqp import authentication, Message, SenderLink, Connection\n\n# Set these environment variables for a runnable example:\n# AMQP_ADDRESS: e.g., \"amqps://<namespace>.servicebus.windows.net/<entity_name>\"\n# SAS_POLICY: e.g., \"RootManageSharedAccessKey\"\n# SAS_KEY: The shared access key for the policy\nAMQP_ADDRESS = os.environ.get(\"AMQP_ADDRESS\", \"amqps://localhost:5672/my_queue\")\nSAS_POLICY = os.environ.get(\"SAS_POLICY\", \"your_sas_policy_name\")\nSAS_KEY = os.environ.get(\"SAS_KEY\", \"your_sas_key\")\n\nconn = None\nsender = None\n\ntry:\n    if not all([AMQP_ADDRESS, SAS_POLICY, SAS_KEY]):\n        print(\"Please set AMQP_ADDRESS, SAS_POLICY, and SAS_KEY environment variables.\")\n        exit(1)\n\n    # Extract hostname (e.g., <namespace>.servicebus.windows.net) from AMQP_ADDRESS\n    hostname = AMQP_ADDRESS.split('//', 1)[-1].split('/', 1)[0].split(':', 1)[0]\n    # Extract target address (e.g., <entity_name>) from AMQP_ADDRESS\n    target_address = AMQP_ADDRESS.split('/', 3)[-1]\n\n    # Create SASL authentication\n    sasl_auth = authentication.SASLPlain(\n        hostname=hostname,\n        username=SAS_POLICY,\n        password=SAS_KEY\n    )\n\n    # Create an AMQP connection\n    print(f\"Connecting to {hostname}...\")\n    conn = Connection(\n        hostname,\n        sasl_auth=sasl_auth,\n        idle_timeout=10000,\n        debug=False # Set to True for verbose AMQP tracing\n    )\n\n    # Create a SenderLink to send messages\n    sender = SenderLink(conn, target_address, debug=False)\n    sender.open()\n    print(f\"SenderLink opened to {target_address}\")\n\n    # Create and send a message\n    message_body = f\"Hello from uAMQP at {time.time()}!\"\n    message = Message(message_body.encode('utf-8'))\n    sender.send_messages([message])\n    print(f\"Sent message: '{message_body}'\")\n\n    time.sleep(1) # Give time for message to be sent\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Ensure your environment variables are correctly configured and the AMQP endpoint is accessible.\")\nfinally:\n    if sender and sender.is_open:\n        sender.close()\n        print(\"SenderLink closed.\")\n    if conn and conn.is_open:\n        conn.close()\n        print(\"Connection closed.\")","lang":"python","description":"This quickstart demonstrates how to establish an AMQP connection, authenticate using SASLPlain, and send a message to a target entity (e.g., an Azure Service Bus queue or Event Hub). It assumes authentication details are provided via environment variables."},"warnings":[{"fix":"For new Azure messaging development (Event Hubs, Service Bus), consider using the higher-level `azure-eventhub` or `azure-servicebus` libraries, which now use a pure Python AMQP implementation. `uamqp` will only receive critical bug and security fixes.","message":"The `uamqp` library is no longer in active development and has moved to a maintenance-only status.","severity":"deprecated","affected_versions":">=1.6.5"},{"fix":"Ensure your system has the necessary build tools (e.g., `build-essential` on Linux, Visual Studio on Windows) and Python development packages installed. It also depends on OpenSSL, which might cause issues on some systems with specific versions.","message":"As a C-extension wrapper, `uamqp` requires C/C++ build tools and Python development headers for installation from source, or if pre-built wheels are not available for your platform/Python version.","severity":"gotcha","affected_versions":"All versions"},{"fix":"The Azure SDKs for Python (`azure-eventhub`, `azure-servicebus`) provide a more idiomatic and higher-level API for interacting with these services. `uamqp` is a lower-level library primarily intended for internal SDK use or advanced AMQP scenarios.","message":"Direct use of `uamqp` for Azure messaging services like Event Hubs or Service Bus is generally not recommended for most users.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}