[ https://issues.apache.org/jira/browse/PROTON-1627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jiri Daněk updated PROTON-1627: ------------------------------- Description: User needs to implement the on_*_ handlers like this {code} void on_connection_open(proton::connection &c) override { proton::messaging_handler::on_connection_open(c); [...] {code} The super implementation does {code} if (c.uninitialized()) { pn_connection_open(unwrap(c)); } {code} There are issues with that. The rule for handlers seems to be. 1) do not call super method in on_*_error, 2) call it everywhere else. This is complicated. Next, hooks are generally expected not to require a super call. https://martinfowler.com/bliki/CallSuper.html Finally, this is not documented on the {{on_connection_open}} method. I only went looking there when I figured what the problem was. was: User needs to implement the on_*_ handlers like this {code} void on_connection_open(proton::connection &c) override { proton::messaging_handler::on_connection_open(c); [...] {code} The super implementation does {code} if (c.uninitialized()) { pn_connection_open(unwrap(c)); } {code} There are issues with that. The rule for handlers seems to be. 1) do not call super method in on_*_error, 2) call it everywhere else. This is complicated. Next, handlers are generally expected not to require a super call. https://martinfowler.com/bliki/CallSuper.html Finally, this is not documented on the {{on_connection_open}} method. I only went looking there when I figured what the problem was. > [cpp] on_*_open handlers require a super call > --------------------------------------------- > > Key: PROTON-1627 > URL: https://issues.apache.org/jira/browse/PROTON-1627 > Project: Qpid Proton > Issue Type: Bug > Components: cpp-binding > Affects Versions: proton-j-0.18.0 > Reporter: Jiri Daněk > Assignee: Cliff Jansen > > User needs to implement the on_*_ handlers like this > {code} > void on_connection_open(proton::connection &c) override { > proton::messaging_handler::on_connection_open(c); > [...] > {code} > The super implementation does > {code} > if (c.uninitialized()) { > pn_connection_open(unwrap(c)); > } > {code} > There are issues with that. The rule for handlers seems to be. 1) do not > call super method in on_*_error, 2) call it everywhere else. This is > complicated. > Next, hooks are generally expected not to require a super call. > https://martinfowler.com/bliki/CallSuper.html > Finally, this is not documented on the {{on_connection_open}} method. I only > went looking there when I figured what the problem was. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org