PROTON-1959: [cpp] Update simple_send example to re-send on reconnect
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/6e9bbe99 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/6e9bbe99 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/6e9bbe99 Branch: refs/heads/master Commit: 6e9bbe99326ad3e674f8b9701b3bd07c46b744ef Parents: d8a83eb Author: Alan Conway <[email protected]> Authored: Tue Oct 30 15:35:35 2018 -0400 Committer: Alan Conway <[email protected]> Committed: Tue Oct 30 16:37:01 2018 -0400 ---------------------------------------------------------------------- cpp/examples/simple_send.cpp | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6e9bbe99/cpp/examples/simple_send.cpp ---------------------------------------------------------------------- diff --git a/cpp/examples/simple_send.cpp b/cpp/examples/simple_send.cpp index a4c2272..8e73fa5 100644 --- a/cpp/examples/simple_send.cpp +++ b/cpp/examples/simple_send.cpp @@ -56,6 +56,12 @@ class simple_send : public proton::messaging_handler { sender = c.open_sender(url, co); } + void on_connection_open(proton::connection& c) OVERRIDE { + if (c.reconnected()) { + sent = confirmed; // Re-send unconfirmed messages after a reconnect + } + } + void on_sendable(proton::sender &s) OVERRIDE { while (s.credit() && sent < total) { proton::message msg; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
