rabbitmq-amqp-python-client 2.0.0b2__tar.gz → 2.0.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/ubuntu/gha-setup.sh +1 -1
  2. rabbitmq_amqp_python_client-2.0.0rc1/CHANGELOG.md +47 -0
  3. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/PKG-INFO +10 -1
  4. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/README.md +9 -0
  5. rabbitmq_amqp_python_client-2.0.0rc1/docs/examples/README.md +35 -0
  6. rabbitmq_amqp_python_client-2.0.0rc1/docs/examples/consumer_priority_example.py +110 -0
  7. rabbitmq_amqp_python_client-2.0.0rc1/docs/examples/multithreaded_example.py +138 -0
  8. rabbitmq_amqp_python_client-2.0.0rc1/docs/examples/quorum_publisher_delay_example.py +113 -0
  9. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/pyproject.toml +1 -1
  10. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/__init__.py +2 -0
  11. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/connection.py +44 -0
  12. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/constants.py +3 -0
  13. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/consumer.py +72 -6
  14. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/publisher.py +17 -0
  15. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/wire/__init__.py +2 -0
  16. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/wire/message.py +31 -0
  17. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/wire/sasl.py +22 -1
  18. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_consumer_integration.py +128 -1
  19. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/fake_broker.py +3 -0
  20. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_consumer.py +137 -0
  21. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_publisher.py +49 -0
  22. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_sasl.py +25 -1
  23. rabbitmq_amqp_python_client-2.0.0b2/docs/examples/README.md +0 -32
  24. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/certs/ca.p12 +0 -0
  25. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/certs/ca_certificate.pem +0 -0
  26. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/certs/ca_key.pem +0 -0
  27. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/certs/client_localhost.p12 +0 -0
  28. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/certs/client_localhost_certificate.pem +0 -0
  29. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/certs/client_localhost_key.pem +0 -0
  30. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/certs/server_localhost.p12 +0 -0
  31. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/certs/server_localhost_certificate.pem +0 -0
  32. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/certs/server_localhost_key.pem +0 -0
  33. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/ubuntu/advanced.config +0 -0
  34. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/ubuntu/enabled_plugins +0 -0
  35. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/ubuntu/gha-log-check.sh +0 -0
  36. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/ubuntu/log/.gitkeep +0 -0
  37. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.ci/ubuntu/rabbitmq.conf +0 -0
  38. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.dockerignore +0 -0
  39. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.github/release.yml +0 -0
  40. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.github/workflows/build-test.yaml +0 -0
  41. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.github/workflows/publish-pypi.yaml +0 -0
  42. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.github/workflows/publish_release.yaml +0 -0
  43. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/.gitignore +0 -0
  44. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/AGENTS.md +0 -0
  45. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/Makefile +0 -0
  46. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/create_tag.sh +0 -0
  47. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/auto_reconnection.py +0 -0
  48. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/basic_connection.py +0 -0
  49. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/console_application.py +0 -0
  50. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/consumer_example.py +0 -0
  51. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/consumer_timeout_example.py +0 -0
  52. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/delayed_retry_context_example.py +0 -0
  53. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/delayed_retry_example.py +0 -0
  54. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/direct_reply_to_example.py +0 -0
  55. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/docker/reliable/Dockerfile +0 -0
  56. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/docker/reliable/README.md +0 -0
  57. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/management_example.py +0 -0
  58. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/performance_test.py +0 -0
  59. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/presettled_consumer_example.py +0 -0
  60. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/publisher_example.py +0 -0
  61. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/quorum_single_active_consumer.py +0 -0
  62. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/rejection_reason_example.py +0 -0
  63. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/reliable.py +0 -0
  64. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/stream_filtering.py +0 -0
  65. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/docs/examples/tls_connection.py +0 -0
  66. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/exceptions.py +0 -0
  67. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/link.py +0 -0
  68. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/logging_utils.py +0 -0
  69. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/management.py +0 -0
  70. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/reconnection.py +0 -0
  71. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/session.py +0 -0
  72. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/wire/delivery_state.py +0 -0
  73. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/wire/encoding.py +0 -0
  74. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/wire/frames.py +0 -0
  75. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/rabbitmq_amqp_python_client/wire/performatives.py +0 -0
  76. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/__init__.py +0 -0
  77. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/__init__.py +0 -0
  78. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/conftest.py +0 -0
  79. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_client_interpolation_integration.py +0 -0
  80. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_client_stream_interpolation_integration.py +0 -0
  81. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_connection_integration.py +0 -0
  82. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_console_application_integration.py +0 -0
  83. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_management_integration.py +0 -0
  84. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_performance_test_integration.py +0 -0
  85. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_publisher_integration.py +0 -0
  86. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_reconnection_integration.py +0 -0
  87. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_session_link_integration.py +0 -0
  88. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/integration/test_tls_integration.py +0 -0
  89. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/__init__.py +0 -0
  90. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/conftest.py +0 -0
  91. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/empty_message.amqp +0 -0
  92. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/header_amqpvalue_message.amqp +0 -0
  93. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/message_body_250.amqp +0 -0
  94. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/message_body_700.amqp +0 -0
  95. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/message_from_version_1_0_0.amqp +0 -0
  96. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/message_random_application_properties_300.amqp +0 -0
  97. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/message_random_application_properties_500.amqp +0 -0
  98. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/message_random_application_properties_properties_900.amqp +0 -0
  99. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/message_unicode_message.amqp +0 -0
  100. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/nil_and_types.amqp +0 -0
  101. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/shovel_annotations.amqp +0 -0
  102. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/static_test_message_compare.amqp +0 -0
  103. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/resources/amqp10_validation/uuid_message.amqp +0 -0
  104. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_amqp10_validation.py +0 -0
  105. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_connection.py +0 -0
  106. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_console_application.py +0 -0
  107. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_delivery_state.py +0 -0
  108. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_encoding.py +0 -0
  109. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_frames.py +0 -0
  110. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_link.py +0 -0
  111. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_management.py +0 -0
  112. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_management_builders.py +0 -0
  113. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_message.py +0 -0
  114. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_package_exports.py +0 -0
  115. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_performance_test.py +0 -0
  116. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_performatives.py +0 -0
  117. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_reconnection.py +0 -0
  118. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_session.py +0 -0
  119. {rabbitmq_amqp_python_client-2.0.0b2 → rabbitmq_amqp_python_client-2.0.0rc1}/tests/unit/test_wire_fuzz.py +0 -0
@@ -7,7 +7,7 @@ set -o xtrace
7
7
  script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8
8
  readonly script_dir
9
9
  echo "[INFO] script_dir: '$script_dir'"
10
- readonly rabbitmq_image=rabbitmq:4.3-management
10
+ readonly rabbitmq_image=rabbitmq:4.4-management
11
11
 
12
12
 
13
13
  readonly docker_name_prefix='rabbitmq-amqp-python-client'
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to the 2.x line of the RabbitMQ AMQP 1.0 Python client are documented in this file.
4
+ Release notes are taken from the [GitHub releases](https://github.com/rabbitmq/rabbitmq-amqp-python-client/releases).
5
+
6
+ > 🚨 Version 2.0 is **not compatible** with 1.x. Be careful before upgrading the library.
7
+ > See the [2.0 discussion](https://github.com/rabbitmq/rabbitmq-amqp-python-client/discussions/123)
8
+ > and the documentation in the [`v2_main` branch](https://github.com/rabbitmq/rabbitmq-amqp-python-client/tree/v2_main).
9
+
10
+ ## [2.0.0-beta.2] - 2026-10-19
11
+
12
+ ### Added
13
+ - Fuzzy tests ([#145](https://github.com/rabbitmq/rabbitmq-amqp-python-client/pull/145))
14
+
15
+ ### Fixed
16
+ - Session window violation caused by conflating delivery-id with transfer-id ([#142](https://github.com/rabbitmq/rabbitmq-amqp-python-client/pull/142))
17
+ - `test_undecodable_deliveries_do_not_stall_the_consumer` test failure ([#144](https://github.com/rabbitmq/rabbitmq-amqp-python-client/pull/144))
18
+
19
+ ## [2.0.0-beta.1] - 2026-09-24
20
+
21
+ First beta of version 2.0.
22
+
23
+ ### Added
24
+ - Dockerfile for `console_application.py` with externalized parameters ([#138](https://github.com/rabbitmq/rabbitmq-amqp-python-client/pull/138))
25
+
26
+ ### Changed
27
+ - Hand credit back when a message handler raises ([#139](https://github.com/rabbitmq/rabbitmq-amqp-python-client/pull/139))
28
+ - Reject undecodable deliveries and hand their credit back ([#140](https://github.com/rabbitmq/rabbitmq-amqp-python-client/pull/140))
29
+
30
+ ### Fixed
31
+ - `initial_credits` not bounding unsettled deliveries ([#136](https://github.com/rabbitmq/rabbitmq-amqp-python-client/issues/136), [#137](https://github.com/rabbitmq/rabbitmq-amqp-python-client/pull/137))
32
+
33
+ ### New Contributors
34
+ - @pasmontesinos made their first contribution in [#139](https://github.com/rabbitmq/rabbitmq-amqp-python-client/pull/139)
35
+
36
+ ## [2.0.0-alpha.3] - 2026-09-08
37
+
38
+ Alpha release of version 2.0. No functional changes listed in the release notes.
39
+
40
+ ## [2.0.0-alpha.2] - 2026-08-31
41
+
42
+ Alpha release of version 2.0. No functional changes listed in the release notes.
43
+
44
+ [2.0.0-beta.2]: https://github.com/rabbitmq/rabbitmq-amqp-python-client/compare/v2.0.0-beta.1...v2.0.0-beta.2
45
+ [2.0.0-beta.1]: https://github.com/rabbitmq/rabbitmq-amqp-python-client/compare/v2.0.0-alpha.3...v2.0.0-beta.1
46
+ [2.0.0-alpha.3]: https://github.com/rabbitmq/rabbitmq-amqp-python-client/compare/v2.0.0-alpha.2...v2.0.0-alpha.3
47
+ [2.0.0-alpha.2]: https://github.com/rabbitmq/rabbitmq-amqp-python-client/releases/tag/v2.0.0-alpha.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: rabbitmq-amqp-python-client
3
- Version: 2.0.0-beta.2
3
+ Version: 2.0.0-rc.1
4
4
  Summary: A from-scratch AMQP 1.0 client for RabbitMQ, built directly against the wire protocol.
5
5
  Author: RabbitMQ Team
6
6
  License: Apache-2.0
@@ -91,6 +91,15 @@ Each one talks to a local broker:
91
91
  PYTHONPATH=. .venv/bin/python docs/examples/basic_connection.py
92
92
  ```
93
93
 
94
+ ### Threading
95
+
96
+ A single `Connection` can be shared by all threads in a process: it guards its
97
+ state and socket writes with internal locks. Create one `Publisher` and one
98
+ `Consumer` per thread rather than sharing them. They are safe to share, but
99
+ they serialise calls, so sharing gains no throughput. Consumer handlers run on
100
+ the client's own delivery threads, so protect any state they share with your
101
+ code. See [`docs/examples/multithreaded_example.py`](docs/examples/multithreaded_example.py).
102
+
94
103
  ## Development
95
104
 
96
105
  ```sh
@@ -74,6 +74,15 @@ Each one talks to a local broker:
74
74
  PYTHONPATH=. .venv/bin/python docs/examples/basic_connection.py
75
75
  ```
76
76
 
77
+ ### Threading
78
+
79
+ A single `Connection` can be shared by all threads in a process: it guards its
80
+ state and socket writes with internal locks. Create one `Publisher` and one
81
+ `Consumer` per thread rather than sharing them. They are safe to share, but
82
+ they serialise calls, so sharing gains no throughput. Consumer handlers run on
83
+ the client's own delivery threads, so protect any state they share with your
84
+ code. See [`docs/examples/multithreaded_example.py`](docs/examples/multithreaded_example.py).
85
+
77
86
  ## Development
78
87
 
79
88
  ```sh
@@ -0,0 +1,35 @@
1
+ # Examples
2
+
3
+ Every example is a standalone script that talks to a local broker on
4
+ `localhost:5672` with the default `guest`/`guest` credentials. Run one from the
5
+ project root, with the project root itself on the path:
6
+
7
+ ```sh
8
+ PYTHONPATH=. .venv/bin/python docs/examples/<example>.py
9
+ ```
10
+
11
+ The table is in reading order: the first four are the client's core surface,
12
+ one layer at a time, and the rest build on them.
13
+
14
+ | Example | What it shows |
15
+ |---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
16
+ | [`basic_connection.py`](basic_connection.py) | The smallest possible program: `Connection(ConnectionParameters())` dials, authenticates and opens in one step, `state` reports `OPEN`, and `close()` shuts it down. Start here. |
17
+ | [`management_example.py`](management_example.py) | Topology over AMQP 1.0 and nothing else: declare a classic queue and a topic exchange, bind them with a routing key, list the bindings the broker reports, then unbind and delete all three. Every call is one request/response pair over the `/management` link pair. |
18
+ | [`publisher_example.py`](publisher_example.py) | The three targets a publisher can have — a queue, an exchange plus a routing key, and none at all. The anonymous publisher sends to two different addresses over one link by setting `properties.to` per message, and a publish to an unbound routing key shows a `RELEASED` outcome, which is not an error. |
19
+ | [`consumer_example.py`](consumer_example.py) | A `message_handler` that accepts and counts every delivery, `unsettled_message_count` while it does, and `pause()`/`unpause()` as flow control: messages published while paused stay queued and arrive the moment credit is restored. |
20
+ | [`auto_reconnection.py`](auto_reconnection.py) | A connection surviving a forced socket drop: publishers and consumers built before the drop keep working afterwards, and `RecoveryConfiguration(topology=True)` re-declares the topology the broker lost. |
21
+ | [`console_application.py`](console_application.py) | The whole client end to end — declare, publish, consume, report — as a scriptable smoke test with meaningful exit codes. `--help` lists its options, every one of which also has an `AMQP_*` environment-variable override; see [`docker/`](docker/) for running it as a container configured entirely that way. |
22
+ | [`reliable.py`](reliable.py) | Modeled on [rabbitmq-amqp-go-client's own `reliable` example](https://github.com/rabbitmq/rabbitmq-amqp-go-client/tree/main/docs/examples/reliable): a publisher and a consumer built once on a quorum queue and left running while a broker disconnect/reconnect can happen at any point without either being rebuilt, with every publish outcome classified and periodic stats logged throughout. Configured entirely through environment variables, no command-line flags; see [`docker/reliable/`](docker/reliable/) for running it as a container. |
23
+ | [`performance_test.py`](performance_test.py) | A throughput/latency generator: many publishers and consumers on one or more connections, with periodic rate and latency reporting. |
24
+ | [`presettled_consumer_example.py`](presettled_consumer_example.py) | At-most-once consumption: `settle_strategy(ConsumerSettleStrategy.PRESETTLED)` attaches with `snd-settle-mode = settled`, so the broker settles every delivery itself, the handler never touches its `Context`, and `unsettled_message_count` stays at `0` for the consumer's whole life — including across a forced disconnect that auto-reconnection recovers from. |
25
+ | [`direct_reply_to_example.py`](direct_reply_to_example.py) | Request/reply without a dedicated reply queue: `settle_strategy(ConsumerSettleStrategy.DIRECT_REPLY_TO)` attaches to no queue at all and reads back a broker-generated pseudo-queue address from `consumer.queue`; a request naming it as `properties.reply_to` gets answered by an ordinary queue-bound consumer publishing to that address. The pseudo-queue is session-scoped, so a forced disconnect and auto-reconnection leave the requester with a brand new address, which the script re-reads before sending its second request. |
26
+ | [`rejection_reason_example.py`](rejection_reason_example.py) | Why a publish was refused: a quorum queue with `max_length(5)` and the `reject-publish` overflow strategy returns a `REJECTED` outcome carrying `RejectionDetails.reason` and `.rejected_by_queue` (needs RabbitMQ 4.3+; the script says so when the broker supplies neither). |
27
+ | [`quorum_single_active_consumer.py`](quorum_single_active_consumer.py) | Single active consumer notifications on a quorum queue (needs RabbitMQ 4.3+): two consumers on a queue declared with `single_active_consumer(True)` each register a `single_active_consumer_state_changed` handler, and the broker tells one of them it is active and the other that it is standby. Only the active one receives messages; closing it promotes the standby one, which then starts receiving. |
28
+ | [`quorum_publisher_delay_example.py`](quorum_publisher_delay_example.py) | Delayed messages on a quorum queue (needs RabbitMQ 4.4+): a publisher stamps each message with an `x-opt-delivery-time` annotation 60 seconds ahead, and a consumer attached from the start receives them only once that time is reached, logging the datetime of every delivery and closing after all `MESSAGE_COUNT` have arrived. See the [delayed messages](https://www.rabbitmq.com/docs/quorum-queues#delayed-messages) documentation. |
29
+ | [`delayed_retry_example.py`](delayed_retry_example.py) | Delaying a redelivery on a quorum queue (needs RabbitMQ 4.3+): a queue declared with `delayed_retry_type(QuorumQueueDelayedRetryType.FAILED)`, `delayed_retry_min(...)` and `delayed_retry_max(...)` holds a `context.discard()`-rejected message back for that window before redelivering it, while a `context.requeue()`-released one — a *returned*, not a *failed*, delivery, so `FAILED` does not cover it — comes back immediately. |
30
+ | [`delayed_retry_context_example.py`](delayed_retry_context_example.py) | Per-message delayed retry (needs RabbitMQ 4.3+): `context.delayed_retry(delay)` stamps an `x-opt-delivery-time` annotation on one redelivery, holding it back for that message alone — no queue-level `x-delayed-retry-*` configuration required at all, unlike `delayed_retry_example.py` above. |
31
+ | [`consumer_timeout_example.py`](consumer_timeout_example.py) | Consumer timeout (needs RabbitMQ 4.3+): `quorum().consumer_timeout(...)` sets the `rabbitmq:consumer-timeout` attach property, and `quorum().on_delivery_release(handler)` is called with a `TimeoutContext` when the broker force-releases a delivery held past that timeout — accepting it there is what lifts the broker's block on further delivery to that consumer. |
32
+ | [`consumer_priority_example.py`](consumer_priority_example.py) | Consumer priority (needs RabbitMQ 4.3+): `consumer_builder().priority(n)` sets the `rabbitmq:priority` attach property, so the broker serves the highest-priority consumer first and falls back to lower ones only when it has no credit left. Two consumers share a queue; the high-priority one receives the whole batch. |
33
+ | [`multithreaded_example.py`](multithreaded_example.py) | Threading: one `Connection` shared by every thread, with one `Publisher` and one `Consumer` per thread. The connection serialises socket writes internally; per-thread publishers and consumers avoid contention. Four workers publish and receive 100 messages on a shared queue. |
34
+ | [`stream_filtering.py`](stream_filtering.py) | Reading a stream queue from a chosen offset and narrowing what arrives (needs RabbitMQ 4.2+ for the SQL filter): the same batch of messages is read back three times from `offset(FIRST)` — once with `filter().subject(...).property("region", ...)`, once with the equivalent `filter().sql(...)`, and once with the cheap, probabilistic `filter_values(...)` bloom filter, whose publisher side is just an `x-stream-filter-value` message annotation. The script reports whether the broker really enforces the SQL filter. |
35
+ | [`tls_connection.py`](tls_connection.py) | TLS transport and certificate-based authentication (needs the broker's TLS listener enabled, `.ci/ubuntu/rabbitmq.conf`): one-way TLS with the broker's certificate verified against `.ci/certs/ca_certificate.pem`, then mutual TLS where a client certificate authenticates via SASL EXTERNAL (`sasl_external=True`) instead of a username/password, and finally — clearly separated and explicitly discouraged — a connection with verification disabled entirely. |
@@ -0,0 +1,110 @@
1
+ """Consumer priority: ``rabbitmq:priority`` (step_140).
2
+
3
+ Run against a local RabbitMQ 4.3+ broker::
4
+
5
+ PYTHONPATH=. .venv/bin/python docs/examples/consumer_priority_example.py
6
+
7
+ When several consumers share a queue, RabbitMQ delivers to the highest-priority
8
+ one that has credit, and falls back to lower-priority ones only when the higher
9
+ ones run out of it. This client surfaces that as ``consumer_builder().priority(n)``
10
+ (the ``rabbitmq:priority`` attach property); the default is ``0``.
11
+
12
+ This script attaches two consumers to one queue — one with a high priority, one
13
+ with the default — publishes a batch, and prints how many messages each got. The
14
+ high-priority consumer receives them all, because it has credit for the whole
15
+ batch. Priority is a preference among consumers *with credit*, not a
16
+ reservation: give it a small ``initial_credits`` and never settle, and the rest
17
+ flow on to the other consumer.
18
+ """
19
+
20
+ from __future__ import annotations
21
+
22
+ import logging
23
+ import threading
24
+ import time
25
+ import uuid
26
+
27
+ from rabbitmq_amqp_python_client import (
28
+ Connection,
29
+ ConnectionParameters,
30
+ Context,
31
+ Message,
32
+ QueueType,
33
+ )
34
+
35
+ #: Messages published to the queue.
36
+ BATCH = 20
37
+
38
+ #: How long the example waits for something it expects to happen.
39
+ TIMEOUT_SECONDS = 20.0
40
+
41
+ logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)-7s %(name)s: %(message)s")
42
+ logger = logging.getLogger("example")
43
+
44
+
45
+ class Counter:
46
+ """Thread-safe count of the deliveries one consumer received."""
47
+
48
+ def __init__(self) -> None:
49
+ self._lock = threading.Lock()
50
+ self._count = 0
51
+
52
+ def __call__(self, context: Context, message: Message) -> None:
53
+ context.accept()
54
+ with self._lock:
55
+ self._count += 1
56
+
57
+ @property
58
+ def count(self) -> int:
59
+ with self._lock:
60
+ return self._count
61
+
62
+
63
+ def consumer_priority() -> None:
64
+ """Show a high-priority consumer served ahead of a default-priority one."""
65
+ connection = Connection(ConnectionParameters(container_id=f"example-consumer-priority-{uuid.uuid4().hex[:8]}"))
66
+ name = f"example-consumer-priority-{uuid.uuid4().hex[:8]}"
67
+ try:
68
+ connection.management().queue(name).type(QueueType.QUORUM).declare()
69
+ logger.info("declared quorum queue %r", name)
70
+
71
+ low, high = Counter(), Counter()
72
+ low_consumer = connection.consumer_builder().queue(name).message_handler(low).initial_credits(BATCH * 2).build()
73
+ high_consumer = (
74
+ connection.consumer_builder()
75
+ .queue(name)
76
+ .message_handler(high)
77
+ .initial_credits(BATCH * 2)
78
+ .priority(10)
79
+ .build()
80
+ )
81
+ logger.info("attached a default-priority consumer and one with rabbitmq:priority=10")
82
+
83
+ try:
84
+ publisher = connection.publisher_builder().queue(name).build()
85
+ try:
86
+ for index in range(BATCH):
87
+ publisher.publish(Message(f"message-{index}"), timeout=TIMEOUT_SECONDS)
88
+ finally:
89
+ publisher.close()
90
+
91
+ deadline = time.monotonic() + TIMEOUT_SECONDS
92
+ while low.count + high.count < BATCH and time.monotonic() < deadline:
93
+ time.sleep(0.05)
94
+ logger.info(
95
+ "high-priority consumer received %d, default-priority consumer received %d", high.count, low.count
96
+ )
97
+ if high.count != BATCH:
98
+ raise RuntimeError(f"expected the high-priority consumer to receive all {BATCH} messages")
99
+ finally:
100
+ high_consumer.close()
101
+ low_consumer.close()
102
+
103
+ connection.management().queue(name).delete()
104
+ logger.info("deleted the queue %r", name)
105
+ finally:
106
+ connection.close()
107
+
108
+
109
+ if __name__ == "__main__":
110
+ consumer_priority()
@@ -0,0 +1,138 @@
1
+ """One shared ``Connection``, one ``Publisher`` and one ``Consumer`` per thread.
2
+
3
+ Run against a local RabbitMQ broker::
4
+
5
+ PYTHONPATH=. .venv/bin/python docs/examples/multithreaded_example.py
6
+
7
+ A single :class:`Connection` can be shared by every thread in the process: its
8
+ state and its socket writes are guarded by internal locks, and one background
9
+ thread reads the inbound frames. A :class:`Publisher` or :class:`Consumer`
10
+ serialises its own calls too, so sharing one is *safe*, but it gains no
11
+ throughput. The recommended layout is therefore:
12
+
13
+ * one ``Connection`` for the whole process,
14
+ * one ``Publisher`` per publishing thread,
15
+ * one ``Consumer`` per consuming thread (its handler runs on the client's own
16
+ delivery thread, so state it shares with your code needs a lock).
17
+
18
+ This script starts ``WORKERS`` threads. Each builds its own publisher and
19
+ consumer on the shared connection, publishes ``MESSAGES_PER_WORKER`` messages
20
+ to a shared queue, and waits until the queue's consumers have received
21
+ everything.
22
+ """
23
+
24
+ from __future__ import annotations
25
+
26
+ import logging
27
+ import threading
28
+ import time
29
+ import uuid
30
+
31
+ from rabbitmq_amqp_python_client import (
32
+ Connection,
33
+ ConnectionParameters,
34
+ Context,
35
+ Message,
36
+ QueueType,
37
+ )
38
+
39
+ #: Worker threads; each owns one publisher and one consumer.
40
+ WORKERS = 4
41
+
42
+ #: Messages each worker publishes.
43
+ MESSAGES_PER_WORKER = 25
44
+
45
+ #: How long the example waits for something it expects to happen.
46
+ TIMEOUT_SECONDS = 30.0
47
+
48
+ logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)-7s %(name)s: %(message)s")
49
+ logger = logging.getLogger("example")
50
+
51
+
52
+ class Received:
53
+ """Thread-safe count of the deliveries every consumer has received."""
54
+
55
+ def __init__(self) -> None:
56
+ self._lock = threading.Lock()
57
+ self._count = 0
58
+
59
+ def __call__(self, context: Context, message: Message) -> None:
60
+ context.accept()
61
+ with self._lock:
62
+ self._count += 1
63
+
64
+ @property
65
+ def count(self) -> int:
66
+ with self._lock:
67
+ return self._count
68
+
69
+
70
+ def worker(
71
+ connection: Connection,
72
+ queue: str,
73
+ index: int,
74
+ received: Received,
75
+ total: int,
76
+ errors: list[BaseException],
77
+ ) -> None:
78
+ """Publish and consume on ``queue`` using this thread's own publisher and consumer."""
79
+ try:
80
+ consumer = connection.consumer_builder().queue(queue).message_handler(received).build()
81
+ try:
82
+ publisher = connection.publisher_builder().queue(queue).build()
83
+ try:
84
+ for number in range(MESSAGES_PER_WORKER):
85
+ publisher.publish(Message(f"worker-{index}-message-{number}"), timeout=TIMEOUT_SECONDS)
86
+ finally:
87
+ publisher.close()
88
+
89
+ # Keep this thread's consumer attached until everything arrived,
90
+ # so no message is stranded when the last consumer closes.
91
+ deadline = time.monotonic() + TIMEOUT_SECONDS
92
+ while received.count < total and time.monotonic() < deadline:
93
+ time.sleep(0.05)
94
+ finally:
95
+ consumer.close()
96
+ except BaseException as error: # noqa: BLE001 - reported to the main thread
97
+ logger.exception("worker %d failed", index)
98
+ errors.append(error)
99
+
100
+
101
+ def multithreaded() -> None:
102
+ """Share one connection between several threads, each with its own publisher and consumer."""
103
+ connection = Connection(ConnectionParameters(container_id=f"example-multithreaded-{uuid.uuid4().hex[:8]}"))
104
+ queue = f"example-multithreaded-{uuid.uuid4().hex[:8]}"
105
+ try:
106
+ connection.management().queue(queue).type(QueueType.QUORUM).declare()
107
+ logger.info("declared quorum queue %r", queue)
108
+
109
+ total = WORKERS * MESSAGES_PER_WORKER
110
+ received = Received()
111
+ errors: list[BaseException] = []
112
+ threads = [
113
+ threading.Thread(
114
+ target=worker,
115
+ args=(connection, queue, index, received, total, errors),
116
+ name=f"worker-{index}",
117
+ )
118
+ for index in range(WORKERS)
119
+ ]
120
+ for thread in threads:
121
+ thread.start()
122
+ for thread in threads:
123
+ thread.join()
124
+
125
+ if errors:
126
+ raise RuntimeError(f"{len(errors)} worker(s) failed") from errors[0]
127
+ logger.info("%d workers published and received %d/%d messages", WORKERS, received.count, total)
128
+ if received.count != total:
129
+ raise RuntimeError(f"expected {total} messages, received {received.count}")
130
+
131
+ connection.management().queue(queue).delete()
132
+ logger.info("deleted the queue %r", queue)
133
+ finally:
134
+ connection.close()
135
+
136
+
137
+ if __name__ == "__main__":
138
+ multithreaded()
@@ -0,0 +1,113 @@
1
+ """Delayed messages on a quorum queue: publish with a delivery time, then consume.
2
+
3
+ Run against a local broker::
4
+
5
+ PYTHONPATH=. .venv/bin/python docs/examples/quorum_publisher_delay_example.py
6
+
7
+ The queue is declared as a quorum queue with ``queue(name).quorum().queue().declare()``:
8
+ ``quorum()`` sets ``x-queue-type`` to ``quorum`` and ``queue()`` returns to the
9
+ plain queue builder for the terminal ``declare()``.
10
+
11
+ ``Message.delivery_after(seconds)`` stamps each message with an
12
+ ``x-opt-delivery-time`` annotation (milliseconds since the epoch) ``seconds``
13
+ ahead, so the quorum queue holds it back and only
14
+ delivers it once that time is reached. See
15
+ https://www.rabbitmq.com/docs/quorum-queues#delayed-messages
16
+
17
+ A queue publisher (``publisher_builder().queue(name)``) targets ``/queues/{name}``.
18
+ Every ``publish`` blocks until the broker settles the message. For a quorum queue
19
+ the ``ACCEPTED`` outcome means the message has been replicated to a majority of
20
+ the queue's members and written to disk, so it is safe to treat as durable.
21
+
22
+ A consumer is attached before publishing. Its handler logs the current datetime
23
+ for every delivery, accepts it, and sets an event once ``MESSAGE_COUNT`` messages
24
+ have arrived; the main thread waits on that event and then closes the consumer.
25
+
26
+ The publisher and the consumer are closed before the connection so their links
27
+ detach cleanly, and the queue is deleted at the end so the example leaves
28
+ nothing behind.
29
+ """
30
+
31
+ from __future__ import annotations
32
+
33
+ import logging
34
+ import threading
35
+ import uuid
36
+ from datetime import datetime
37
+
38
+ from rabbitmq_amqp_python_client import Connection, ConnectionParameters, Context, Message
39
+
40
+ #: How many messages to publish.
41
+ MESSAGE_COUNT = 10
42
+
43
+ #: How long each message is held back by the broker before delivery.
44
+ DELAY_SECONDS = 60
45
+
46
+ #: How long to wait for all the messages to be received. The published messages
47
+ #: carry a delivery time :data:`DELAY_SECONDS` ahead, so this must be longer than that.
48
+ RECEIVE_TIMEOUT_SECONDS = DELAY_SECONDS + 30.0
49
+
50
+ logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)-7s %(name)s: %(message)s")
51
+ logger = logging.getLogger("example")
52
+
53
+
54
+ class Receiver:
55
+ """Accepts every delivery, logs when it arrived, and signals once all have."""
56
+
57
+ def __init__(self, expected: int) -> None:
58
+ """Wait for ``expected`` deliveries."""
59
+ self.expected = expected
60
+ self.count = 0
61
+ self.done = threading.Event()
62
+
63
+ def on_message(self, context: Context, message: Message) -> None:
64
+ """Log the receive time of one delivery and accept it."""
65
+ self.count += 1
66
+ logger.info(
67
+ "received at %s: %r (%d/%d)",
68
+ datetime.now().isoformat(),
69
+ message.body_as_string(),
70
+ self.count,
71
+ self.expected,
72
+ )
73
+ context.accept()
74
+ if self.count >= self.expected:
75
+ self.done.set()
76
+
77
+
78
+ def quorum_publisher_delay_example() -> None:
79
+ """Declare a quorum queue, publish to it, consume everything, then delete it."""
80
+ queue_name = f"example-quorum-{uuid.uuid4().hex[:8]}"
81
+ connection = Connection(ConnectionParameters(container_id=f"example-quorum-publisher-{uuid.uuid4().hex[:8]}"))
82
+ try:
83
+ management = connection.management()
84
+ management.queue(queue_name).quorum().queue().declare()
85
+ logger.info("declared the quorum queue %r", queue_name)
86
+
87
+ receiver = Receiver(MESSAGE_COUNT)
88
+ consumer = connection.consumer_builder().queue(queue_name).message_handler(receiver.on_message).build()
89
+ publisher = connection.publisher_builder().queue(queue_name).build()
90
+ try:
91
+ for i in range(MESSAGE_COUNT):
92
+ msgq = Message(f"message {i}").delivery_after(DELAY_SECONDS)
93
+ result = publisher.publish(msgq)
94
+ logger.info("%r -> %s", result.message.body_as_string(), result.outcome.state.value)
95
+
96
+ if not receiver.done.wait(timeout=RECEIVE_TIMEOUT_SECONDS):
97
+ logger.warning("only %d/%d message(s) received before the timeout", receiver.count, MESSAGE_COUNT)
98
+ finally:
99
+ publisher.close()
100
+ consumer.close()
101
+ logger.info("closed the publisher and the consumer after %d message(s)", receiver.count)
102
+
103
+ info = management.queue_info(queue_name)
104
+ logger.info("queue %r (%s) holds %d message(s)", queue_name, info.queue_type.value, info.message_count)
105
+
106
+ management.queue(queue_name).delete()
107
+ logger.info("deleted the queue %r", queue_name)
108
+ finally:
109
+ connection.close()
110
+
111
+
112
+ if __name__ == "__main__":
113
+ quorum_publisher_delay_example()
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "rabbitmq-amqp-python-client"
7
- version = "2.0.0-beta.2"
7
+ version = "2.0.0-rc.1"
8
8
  description = "A from-scratch AMQP 1.0 client for RabbitMQ, built directly against the wire protocol."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -63,6 +63,7 @@ from .management import (
63
63
  StreamSpecification,
64
64
  )
65
65
  from .publisher import (
66
+ DeliveryAfter,
66
67
  Outcome,
67
68
  OutcomeState,
68
69
  Publisher,
@@ -171,6 +172,7 @@ __all__ = [
171
172
  "StreamOffsetSpecification",
172
173
  "TimeoutContext",
173
174
  "queue_address",
175
+ "DeliveryAfter",
174
176
  "exchange_address",
175
177
  "Message",
176
178
  "Header",
@@ -11,6 +11,7 @@ it in a later step.
11
11
  from __future__ import annotations
12
12
 
13
13
  import contextlib
14
+ import re
14
15
  import socket
15
16
  import ssl
16
17
  import threading
@@ -70,12 +71,42 @@ CONTAINER_ID_PREFIX = "rabbitmq-amqp-python-client"
70
71
  #: Condition RabbitMQ uses when it rejects the credentials or the virtual host.
71
72
  UNAUTHORIZED_ACCESS_CONDITION = "amqp:unauthorized-access"
72
73
 
74
+ #: ``(major, minor, patch)`` of the broker, as :attr:`Connection.broker_version` reports it.
75
+ BrokerVersion = tuple[int, int, int]
76
+
77
+ #: Leading ``<major>.<minor>[.<patch>]`` of the ``version`` the broker announces in ``open.properties``.
78
+ _BROKER_VERSION_PATTERN = re.compile(r"^\s*(\d+)\.(\d+)(?:\.(\d+))?")
79
+
80
+ #: ``open.properties`` key under which RabbitMQ announces its version (step_140 §3).
81
+ BROKER_VERSION_PROPERTY = "version"
82
+
73
83
  CONNECT_TIMEOUT_SECONDS = 30.0
74
84
  HANDSHAKE_TIMEOUT_SECONDS = 30.0
75
85
  CLOSE_TIMEOUT_SECONDS = 10.0
76
86
  THREAD_JOIN_TIMEOUT_SECONDS = 5.0
77
87
  MIN_HEARTBEAT_INTERVAL_SECONDS = 1.0
78
88
 
89
+
90
+ def parse_broker_version(text: object) -> BrokerVersion | None:
91
+ """Parse the ``version`` a broker announces in its ``open`` properties (step_140 §3).
92
+
93
+ Args:
94
+ text: The raw property value; anything that is not a string is unknown.
95
+
96
+ Returns:
97
+ ``(major, minor, patch)``, with a missing patch as ``0`` and any suffix
98
+ (``-rc.1``, ``+dev``) ignored — or ``None`` when ``text`` does not start
99
+ with ``<digits>.<digits>``.
100
+ """
101
+ if not isinstance(text, str):
102
+ return None
103
+ match = _BROKER_VERSION_PATTERN.match(text)
104
+ if match is None:
105
+ return None
106
+ major, minor, patch = match.groups()
107
+ return int(major), int(minor), int(patch or 0)
108
+
109
+
79
110
  #: Callback invoked at most once when the connection dies without ``close()``.
80
111
  #: Receives the failure that killed it, or ``None`` when the peer closed
81
112
  #: cleanly (a ``close`` performative carrying no ``error``).
@@ -319,6 +350,19 @@ class Connection:
319
350
  """The peer's ``open`` performative, available once bootstrap succeeded."""
320
351
  return self._remote_open
321
352
 
353
+ @property
354
+ def broker_version(self) -> BrokerVersion | None:
355
+ """The broker's ``(major, minor, patch)`` from its ``open`` properties, or ``None`` if unknown.
356
+
357
+ Read from the current connection's ``open``, so it follows an automatic
358
+ reconnect to a different broker. ``None`` when the broker did not
359
+ announce a parseable ``version`` (step_140 §3).
360
+ """
361
+ remote_open = self._remote_open
362
+ if remote_open is None or remote_open.properties is None:
363
+ return None
364
+ return parse_broker_version(remote_open.properties.get(BROKER_VERSION_PROPERTY))
365
+
322
366
  def open_session(self) -> Session:
323
367
  """Begin a new session on the next free channel.
324
368
 
@@ -19,6 +19,9 @@ RABBITMQ_ACTIVE_PROPERTY = "rabbitmq:active"
19
19
  # --- Consumer timeout (quorum queues, RabbitMQ 4.3+, step_130 §2) ---
20
20
  RABBITMQ_CONSUMER_TIMEOUT_PROPERTY = "rabbitmq:consumer-timeout"
21
21
 
22
+ # --- Consumer priority (classic and quorum queues, RabbitMQ 4.3+, step_140 §1) ---
23
+ RABBITMQ_PRIORITY_PROPERTY = "rabbitmq:priority"
24
+
22
25
  # --- Per-message delayed retry (quorum queues, RabbitMQ 4.3+, step_120 §1) ---
23
26
  DELIVERY_TIME_ANNOTATION = "x-opt-delivery-time"
24
27