feat(consumer): quorum SAC notifications via FLOW rabbitmq:active#109
Merged
Conversation
Register the SAC callback on the AMQP transport *before* receiver creation so the initial rabbitmq:active FLOW frame – sent by RabbitMQ 4.3+ as part of the ATTACH handshake – is captured correctly. New files: - rabbitmq_amqp_python_client/qpid/proton/_flow_properties.py Low-level AMQP byte parser that scans raw frames for FLOW performatives and extracts the rabbitmq:active boolean from the link-state properties map. - tests/test_quorum_queue_sac.py Integration tests: first consumer becomes active, second starts as standby, standby promoted on active close, plus validation tests. - examples/quorum_queue_sac/example_quorum_queue_sac.py Runnable demo with two consumers showing live ACTIVE/STANDBY transitions. Modified files: - qpid/proton/_handlers.py: hook IOHandler.on_selectable_readable to invoke the SAC callback whenever a matching FLOW frame arrives. - entities.py: add QuorumConsumerOptions(sac_state_handler=...) with validation (requires RabbitMQ 4.3+, incompatible with DirectReplyTo). - consumer.py: _register_sac_callback() / _unregister_sac_callback() stored on conn.transport; registration happens before _create_receiver() to avoid the timing race with the initial ATTACH FLOW frame. - connection.py: pass "4.3.0" version flag to consumer_options.validate(). - __init__.py: export QuorumConsumerOptions in the public API. - CHANGELOG.md, examples/README.md: document the new feature. Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com> Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Register the SAC callback on the AMQP transport before receiver creation so the initial rabbitmq:active FLOW frame – sent by RabbitMQ 4.3+ as part of the ATTACH handshake – is captured correctly.
New files:
Modified files: