PROTON-1153: [C++ binding] Tidy up proton::handler
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/e3e1d7da Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/e3e1d7da Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/e3e1d7da Branch: refs/heads/master Commit: e3e1d7da55b859f17935c5d3ad32ea826fed1294 Parents: f55a67b Author: Andrew Stitcher <[email protected]> Authored: Thu Feb 25 17:15:02 2016 -0500 Committer: Andrew Stitcher <[email protected]> Committed: Wed Mar 2 10:35:06 2016 -0500 ---------------------------------------------------------------------- proton-c/bindings/cpp/include/proton/event.hpp | 2 +- .../bindings/cpp/include/proton/handler.hpp | 26 +++++++++++--------- proton-c/bindings/cpp/src/handler.cpp | 3 --- 3 files changed, 15 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e3e1d7da/proton-c/bindings/cpp/include/proton/event.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/event.hpp b/proton-c/bindings/cpp/include/proton/event.hpp index 4cbcf51..14dd727 100644 --- a/proton-c/bindings/cpp/include/proton/event.hpp +++ b/proton-c/bindings/cpp/include/proton/event.hpp @@ -37,7 +37,7 @@ class connection; /// A context for a proton event. /// -/// @see proton::handler +/// @see proton::handler class event { public: virtual PN_CPP_EXTERN ~event() {} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e3e1d7da/proton-c/bindings/cpp/include/proton/handler.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/handler.hpp b/proton-c/bindings/cpp/include/proton/handler.hpp index 979173f..28da99d 100644 --- a/proton-c/bindings/cpp/include/proton/handler.hpp +++ b/proton-c/bindings/cpp/include/proton/handler.hpp @@ -78,17 +78,26 @@ PN_CPP_CLASS_EXTERN handler /// A message can be sent. PN_CPP_EXTERN virtual void on_sendable(event &e); - // XXX _open is not present because it's + /// transport_open is not present because currently there is no specific + /// low level event to hang it from - you should put any initialisation code + /// that needs a transport into the conection_open event. + /// XXX Actually this makes me wonder if we shouldn't just introduce this event + /// XXX and call its handler immediately before on_connection_open, just for the + /// XXX symmetry of the API. - // XXX you get close and error on a failure, and you get the error first - // XXX - for each _error item, document that you will get _close as well - /// The underlying network transport has closed. PN_CPP_EXTERN virtual void on_transport_close(event &e); /// The underlying network transport has closed with an error /// condition. PN_CPP_EXTERN virtual void on_transport_error(event &e); + /// Note that every ..._open event is paired with a ..._close event which can clean + /// up any resources created by the ..._open handler. + /// In particular this is still true if an error is reported with an ..._error event. + /// This makes resource management easier so that the error handling logic doesn't also + /// have to manage the resource clean up, but can just assume that the close event will + /// be along in a minute to handle the clean up. + /// The remote peer opened the connection. PN_CPP_EXTERN virtual void on_connection_open(event &e); /// The remote peer closed the connection. @@ -124,13 +133,6 @@ PN_CPP_CLASS_EXTERN handler // XXX note that AMQP modified state is indicated in _release - /// The remote peer declared a transaction. - PN_CPP_EXTERN virtual void on_transaction_declare(event &e); - /// The remote peer committed a transaction. - PN_CPP_EXTERN virtual void on_transaction_commit(event &e); - /// The remote peer aborted a transaction. - PN_CPP_EXTERN virtual void on_transaction_abort(event &e); - /// @cond INTERNAL /// XXX settle API questions around task /// XXX register functions instead of having these funny generic events @@ -145,10 +147,10 @@ PN_CPP_CLASS_EXTERN handler /// @} + /// @cond INTERNAL private: pn_unique_ptr<messaging_adapter> messaging_adapter_; - /// @cond INTERNAL friend class container; friend class connection_engine; friend class connection_options; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e3e1d7da/proton-c/bindings/cpp/src/handler.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/handler.cpp b/proton-c/bindings/cpp/src/handler.cpp index 5948b36..c30e658 100644 --- a/proton-c/bindings/cpp/src/handler.cpp +++ b/proton-c/bindings/cpp/src/handler.cpp @@ -57,9 +57,6 @@ void handler::on_delivery_accept(event &e) { on_unhandled(e); } void handler::on_delivery_reject(event &e) { on_unhandled(e); } void handler::on_delivery_release(event &e) { on_unhandled(e); } void handler::on_delivery_settle(event &e) { on_unhandled(e); } -void handler::on_transaction_abort(event &e) { on_unhandled(e); } -void handler::on_transaction_commit(event &e) { on_unhandled(e); } -void handler::on_transaction_declare(event &e) { on_unhandled(e); } void handler::on_unhandled(event &) {} void handler::on_unhandled_error(event &, const condition& c) { throw proton::error(c.str()); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
