Merge lp://staging/~free.ekanayaka/txamqp/closing-logic-cleanup into lp://staging/txamqp
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 76 | ||||
Proposed branch: | lp://staging/~free.ekanayaka/txamqp/closing-logic-cleanup | ||||
Merge into: | lp://staging/txamqp | ||||
Diff against target: |
304 lines (+183/-7) 6 files modified
src/txamqp/client.py (+6/-1) src/txamqp/protocol.py (+50/-5) src/txamqp/test/test_broker.py (+9/-0) src/txamqp/test/test_endpoint.py (+1/-1) src/txamqp/test/test_protocol.py (+113/-0) src/txamqp/testing.py (+4/-0) |
||||
To merge this branch: | bzr merge lp://staging/~free.ekanayaka/txamqp/closing-logic-cleanup | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Adam Collard (community) | Approve | ||
Alberto Donato (community) | Approve | ||
txAMQP Team | Pending | ||
Review via email: mp+296665@code.staging.launchpad.net |
Description of the change
This branch implements the following changes:
- TwistedDelegate
- AMQClient now has a new "disconnected" instance attribute, which is a TwistedEvent that consumer code can wait on in order to know when the transport has actually shut down. This is useful for integrating txamqp with things like twisted.
- AMQClient.closed is now properly initialized in the __init__ (it was set dynamically before), so it's always safe to inspect it.
- The AMQClient.sendHB LoopingCall now gets the same clock as AMQClient, instead of the global reactor. This makes unit-testing easier.
- AMQClient.queues (of type TimeoutDeferred
- The "reason" parameter of AMQClient.close is now optional and defaults to ConnectionDone.
- AMQClient.close has a new "within" parameter, which tells the client to possibly try to perform a clean connection shutdown with the 'close'/'close-ok' frames handshake. If the handshake doesn't succeed in "within" seconds, the transport connection gets terminated without handshake. The default of the new parameter is 0, which means "do close immediately without handshake", so there's should be no behavior change at all for existing code, expect that close() now returns a Deferred, but it seems minor, since the non-handshake code is still all synchronous.
- The old AMQClient.close logic has been moved to AMQClient.doClose, which is basically the same pattern as AMQChannel.
- AMQClient.
- Unit tests and integration tests where added for all the behavior above.
Phew, that was quite a bit of narrative, really hope the diff isn't controversial :)
After this branch I have a final small one that allows application code to distinguish between connection close errors and channel close errors (with two new subclasses of Close). Other than that I have no immediate pending work on txamqp, but I'd like to resume:
https:/
and have support for confirms.
Thanks!
Hi Esteve, any take on this change? Or you didn't have time to look at it yet? Cheers