You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by astitcher <gi...@git.apache.org> on 2017/05/17 17:54:02 UTC
[GitHub] qpid-proton pull request #105: Port of C++ binding to Proton Proactor
GitHub user astitcher opened a pull request:
https://github.com/apache/qpid-proton/pull/105
Port of C++ binding to Proton Proactor
This set of changes reimplements the C++ binding do that it no longer uses the Proton Reactor library at all and now only links to the Proton Core and Proton Proactor libraries.
It is not 100% finished yet, missing pieces include:
* Multi thread support - Currently the API is thread safe if you obey the thread safety rules, but only one thread is used to service handler callbacks - This will be fixed soon.
* Reconnect is not implemented - If a network connection fails no reconnect action is attempted - This will also be fixed, but ntoe that the C++ binding implementation of reconnect is subject to change as we don't have a lot of experience with it yet.
Included in this PR is a reworking of the mechanism for injecting work into safe contexts. The concepts have been renamed for clarity (`proton::work_queue` & `proton::work`) and some convenience functions have been added to help those (poor benighted souls) using C++03. There is some more work to come which should also improve injecting work using the scheduler.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/astitcher/qpid-proton cpp-proactor
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/qpid-proton/pull/105.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #105
----
commit 96435b5cfac13283c612ba60feefd73901bc9c4f
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-01-23T17:32:50Z
PROTON-1400: [C++ binding] Removed proton_event and proton_handler
- Removed old low level proton event handling completely
- Now directly dispatch to the messaging_handler
- Moved private message::decode directly into message handling code
commit 84dcd7bcaa97106ef43a6a8b44a7f3e819f07107
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-01-25T04:36:03Z
PROTON-1400: WIP Use the mt broker example as the example instead of the previous st broker
- The st broker didn't correctly respect the object access constraints from within handlers
commit b95f252ede1aaa20c8a5fd1abd42fdbe2c7c3ebe
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-02-08T07:32:36Z
PROTON-1400: [C++ binding] Proactor container implementation
- Remove all reactor use
- Rearrange object context code
- Change container includes to proactor container includes
commit ea7f0e989ba5b90aa322b38336dfbbb089fae899
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-02-09T01:12:36Z
PROTON-1400: [C++ binding] Remove reactor container implementation files.
commit a0c9e9a756d452bc7c992e4a9875f681b69d5c44
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-03-03T20:51:58Z
NO-JIRA: Header file corrections
commit 6ed1d1ab4a68f0a132f44b59a09b1582a2f6b4ff
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-03-28T17:45:28Z
PROTON-1400: [C++ example] Rework broker to use container event loops
commit db92f4c73444d186899e5fa28e638195f3adf5f4
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-04-14T06:13:12Z
PROTON-1400: [C+ binding] Change semantic for incoming xx_open
- If not overridden then you get automatic outgoing matching xx_open
- If overridden then it is assumed you will handle the outgoing open
yourself.
commit a52e5d16363caa736062359dab0733b4db6b8992
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-04-20T19:20:40Z
PROTON-1400: Implement container level event_loops
commit 95a7ded6410e599f6327adedbf5386b5d8b4fca1
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-04-27T17:05:14Z
PROTON-1400: [C++ binding] Use pn_proactor_now() to implement timestamp::now()
commit 2da87d20cff09b00503dd70341fde73b5ae36bd5
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-05-15T05:27:54Z
PROTON-1481: [C++ binding] Rename event_loop API to work_queue
commit efd5ec09f1a7cfc311fe8f612d48160ce16d7e2b
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-05-15T05:36:52Z
PROTON-1481: [C++ binding] simpify work_queue code by introducing work type
- The work type can be created from std::function<void()> or void_function0
- and so pushes those c++1/C++03 differences into a single place
commit e252354b82f3a4273275a15da614abda3859a2c9
Author: Andrew Stitcher <as...@apache.org>
Date: 2017-05-15T05:45:43Z
PROTON-1481: [C++ binding] Split out general work deferring functions to the work_queue header
Add efficient C++11 versions of work factories
Reorder defer arguments to be like std::bind
Add extra overloads for defer like std::bind (for free functions arbitrary work_queues)
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-proton pull request #105: Port of C++ binding to Proton Proactor
Posted by alanconway <gi...@git.apache.org>.
Github user alanconway commented on a diff in the pull request:
https://github.com/apache/qpid-proton/pull/105#discussion_r118509113
--- Diff: proton-c/bindings/cpp/src/handler.cpp ---
@@ -49,17 +50,33 @@ void messaging_handler::on_transport_error(transport &t) { on_error(t.error());
void messaging_handler::on_transport_open(transport &) {}
void messaging_handler::on_connection_close(connection &) {}
void messaging_handler::on_connection_error(connection &c) { on_error(c.error()); }
-void messaging_handler::on_connection_open(connection &) {}
+void messaging_handler::on_connection_open(connection &c) {
+ if (c.uninitialized()) {
+ pn_connection_open(unwrap(c));
+ }
+}
void messaging_handler::on_session_close(session &) {}
void messaging_handler::on_session_error(session &s) { on_error(s.error()); }
-void messaging_handler::on_session_open(session &) {}
+void messaging_handler::on_session_open(session &s) {
+ if (s.uninitialized()) {
+ pn_session_open(unwrap(s));
+ }
+}
void messaging_handler::on_receiver_close(receiver &) {}
void messaging_handler::on_receiver_error(receiver &l) { on_error(l.error()); }
-void messaging_handler::on_receiver_open(receiver &) {}
+void messaging_handler::on_receiver_open(receiver &l) {
+ if (l.uninitialized()) {
+ l.open(l.container().receiver_options());
+ }
+}
void messaging_handler::on_receiver_detach(receiver &) {}
void messaging_handler::on_sender_close(sender &) {}
void messaging_handler::on_sender_error(sender &l) { on_error(l.error()); }
-void messaging_handler::on_sender_open(sender &) {}
+void messaging_handler::on_sender_open(sender &l) {
+ if (l.uninitialized()) {
+ l.open(l.container().sender_options());
--- End diff --
This looks like it will throw if the listener is not associated with a container. I want to still support pure connection_driver based application that might not have a "real" container impl - we could have a "null container" with only a container ID. That can be fixed later - not an objection to this commit.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-proton pull request #105: Port of C++ binding to Proton Proactor
Posted by ssorj <gi...@git.apache.org>.
Github user ssorj commented on a diff in the pull request:
https://github.com/apache/qpid-proton/pull/105#discussion_r117524348
--- Diff: proton-c/bindings/cpp/include/proton/message.hpp ---
@@ -329,11 +329,7 @@ class message {
mutable annotation_map message_annotations_;
mutable annotation_map delivery_annotations_;
- /// Decode the message corresponding to a delivery from a link.
--- End diff --
How does this relate to the other changes here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-proton pull request #105: Port of C++ binding to Proton Proactor
Posted by astitcher <gi...@git.apache.org>.
Github user astitcher commented on a diff in the pull request:
https://github.com/apache/qpid-proton/pull/105#discussion_r117554762
--- Diff: proton-c/bindings/cpp/include/proton/work_queue.hpp ---
@@ -0,0 +1,368 @@
+#ifndef PROTON_EVENT_LOOP_HPP
--- End diff --
Will fix.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-proton pull request #105: Port of C++ binding to Proton Proactor
Posted by astitcher <gi...@git.apache.org>.
Github user astitcher commented on a diff in the pull request:
https://github.com/apache/qpid-proton/pull/105#discussion_r117555738
--- Diff: proton-c/bindings/cpp/include/proton/message.hpp ---
@@ -329,11 +329,7 @@ class message {
mutable annotation_map message_annotations_;
mutable annotation_map delivery_annotations_;
- /// Decode the message corresponding to a delivery from a link.
--- End diff --
This is a private function that didn't need exposing. So I moved it to the internals.
I can't remember anymore if this change was enabled by other things changed or not. But the code moved into message_adapter.cpp which also changed a lot in the same change.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-proton pull request #105: Port of C++ binding to Proton Proactor
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/qpid-proton/pull/105
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-proton pull request #105: Port of C++ binding to Proton Proactor
Posted by ssorj <gi...@git.apache.org>.
Github user ssorj commented on a diff in the pull request:
https://github.com/apache/qpid-proton/pull/105#discussion_r117524549
--- Diff: proton-c/bindings/cpp/include/proton/work_queue.hpp ---
@@ -0,0 +1,368 @@
+#ifndef PROTON_EVENT_LOOP_HPP
--- End diff --
This needs a rename.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-proton issue #105: Port of C++ binding to Proton Proactor
Posted by alanconway <gi...@git.apache.org>.
Github user alanconway commented on the issue:
https://github.com/apache/qpid-proton/pull/105
I'm still happy with this. I have some ideas about simplifying the returned<>/thread_safe<> story but lets get this up on master as a starting point.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-proton issue #105: Port of C++ binding to Proton Proactor
Posted by astitcher <gi...@git.apache.org>.
Github user astitcher commented on the issue:
https://github.com/apache/qpid-proton/pull/105
I've now rebased and slightly modified some the previous commits.
Substantively I've addressed the work_queue header guard issue; finished the work dealing with scheduling work to occur in different contexts; renamed proton::defer to proton::schedule_work.
Note that the commits in the branch *are not* in the order display in this PR because they have been heavily reworked and reordered in rebases. So the creation time does not correspond to the commit order.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-proton issue #105: Port of C++ binding to Proton Proactor
Posted by astitcher <gi...@git.apache.org>.
Github user astitcher commented on the issue:
https://github.com/apache/qpid-proton/pull/105
I've now updated this with what I intend to be the final rebase before merging.
Everything is functionally there except for reconnect, which will be addressed in the 0.19 timescale.
* Multhtreaded container is now implemented
* The (still) experimental connection_driver now works.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org