[ 
https://issues.apache.org/jira/browse/PROTON-2308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17463839#comment-17463839
 ] 

ASF GitHub Bot commented on PROTON-2308:
----------------------------------------

astitcher commented on a change in pull request #346:
URL: https://github.com/apache/qpid-proton/pull/346#discussion_r773914859



##########
File path: cpp/src/link_test.cpp
##########
@@ -23,9 +23,121 @@
 #include <proton/sender_options.hpp>
 #include <proton/receiver_options.hpp>
 #include <proton/container.hpp>
+#include <proton/connection.hpp>
+#include <proton/connection_options.hpp>
+#include <proton/listen_handler.hpp>
+#include <proton/listener.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/types.hpp>
+#include <proton/message.hpp>
+#include <proton/target_options.hpp>
+#include <proton/source_options.hpp>
+#include <proton/delivery.hpp>
 
 #include <iostream>
 
+#include <map>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+
+namespace {
+std::mutex m;
+std::condition_variable cv;
+bool listener_ready = false;
+int listener_port;
+const std::string DYNAMIC_ADDRESS = "test_dynamic_address";
+} // namespace
+
+class test_recv : public proton::messaging_handler {
+  private:
+    class listener_ready_handler : public proton::listen_handler {
+        void on_open(proton::listener &l) override {
+            {
+                std::lock_guard<std::mutex> lk(m);
+                listener_port = l.port();
+                listener_ready = true;
+            }
+            cv.notify_one();
+        }
+    };
+
+    std::string url;
+    proton::listener listener;
+    listener_ready_handler listen_handler;
+
+  public:
+    test_recv(const std::string &s) : url(s) {}
+
+    void on_container_start(proton::container &c) override {
+        listener = c.listen(url, listen_handler);
+    }
+
+    void on_receiver_open(proton::receiver& r) override {
+        std::map<proton::symbol,proton::value> 
m_sender({{proton::symbol("supported-dist-modes"), proton::value("move")}});

Review comment:
       Per the standard I think 'move' needs to be a symbol too. I think this 
will create an AMQP string value of 'move' which is not what the standard 
requests.

##########
File path: cpp/src/link_test.cpp
##########
@@ -23,9 +23,121 @@
 #include <proton/sender_options.hpp>
 #include <proton/receiver_options.hpp>
 #include <proton/container.hpp>
+#include <proton/connection.hpp>
+#include <proton/connection_options.hpp>
+#include <proton/listen_handler.hpp>
+#include <proton/listener.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/types.hpp>
+#include <proton/message.hpp>
+#include <proton/target_options.hpp>
+#include <proton/source_options.hpp>
+#include <proton/delivery.hpp>
 
 #include <iostream>
 
+#include <map>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+
+namespace {
+std::mutex m;
+std::condition_variable cv;
+bool listener_ready = false;
+int listener_port;
+const std::string DYNAMIC_ADDRESS = "test_dynamic_address";
+} // namespace
+
+class test_recv : public proton::messaging_handler {
+  private:
+    class listener_ready_handler : public proton::listen_handler {
+        void on_open(proton::listener &l) override {
+            {
+                std::lock_guard<std::mutex> lk(m);
+                listener_port = l.port();
+                listener_ready = true;
+            }
+            cv.notify_one();
+        }
+    };
+
+    std::string url;
+    proton::listener listener;
+    listener_ready_handler listen_handler;
+
+  public:
+    test_recv(const std::string &s) : url(s) {}
+
+    void on_container_start(proton::container &c) override {
+        listener = c.listen(url, listen_handler);
+    }
+
+    void on_receiver_open(proton::receiver& r) override {
+        std::map<proton::symbol,proton::value> 
m_sender({{proton::symbol("supported-dist-modes"), proton::value("move")}});
+        std::map<proton::symbol,proton::value> props = 
r.target().dynamic_properties();
+
+        ASSERT(r.target().dynamic());
+        ASSERT(r.target().address().empty());
+        ASSERT_EQUAL(m_sender, props);
+
+        proton::target_options opts;
+        std::map<proton::symbol, proton::value> 
m({{proton::symbol("supported-dist-modes"), proton::value("copy")}});

Review comment:
       As above I think this should be 
```proton::value(proton::symbol("copy"))```

##########
File path: cpp/src/link_test.cpp
##########
@@ -23,9 +23,121 @@
 #include <proton/sender_options.hpp>
 #include <proton/receiver_options.hpp>
 #include <proton/container.hpp>
+#include <proton/connection.hpp>
+#include <proton/connection_options.hpp>
+#include <proton/listen_handler.hpp>
+#include <proton/listener.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/types.hpp>
+#include <proton/message.hpp>
+#include <proton/target_options.hpp>
+#include <proton/source_options.hpp>
+#include <proton/delivery.hpp>
 
 #include <iostream>
 
+#include <map>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+
+namespace {
+std::mutex m;
+std::condition_variable cv;
+bool listener_ready = false;
+int listener_port;
+const std::string DYNAMIC_ADDRESS = "test_dynamic_address";
+} // namespace
+
+class test_recv : public proton::messaging_handler {
+  private:
+    class listener_ready_handler : public proton::listen_handler {
+        void on_open(proton::listener &l) override {
+            {
+                std::lock_guard<std::mutex> lk(m);
+                listener_port = l.port();
+                listener_ready = true;
+            }
+            cv.notify_one();
+        }
+    };
+
+    std::string url;
+    proton::listener listener;
+    listener_ready_handler listen_handler;
+
+  public:
+    test_recv(const std::string &s) : url(s) {}
+
+    void on_container_start(proton::container &c) override {
+        listener = c.listen(url, listen_handler);
+    }
+
+    void on_receiver_open(proton::receiver& r) override {
+        std::map<proton::symbol,proton::value> 
m_sender({{proton::symbol("supported-dist-modes"), proton::value("move")}});
+        std::map<proton::symbol,proton::value> props = 
r.target().dynamic_properties();
+
+        ASSERT(r.target().dynamic());
+        ASSERT(r.target().address().empty());
+        ASSERT_EQUAL(m_sender, props);
+
+        proton::target_options opts;
+        std::map<proton::symbol, proton::value> 
m({{proton::symbol("supported-dist-modes"), proton::value("copy")}});
+        opts.address(DYNAMIC_ADDRESS);
+        opts.dynamic_properties(m);
+        if (r.uninitialized()) {
+            r.open(proton::receiver_options().target(opts));
+        }
+        listener.stop();
+    }
+};
+
+class test_send : public proton::messaging_handler {
+  private:
+    std::string url;
+
+  public:
+    test_send(const std::string& s) : url(s) {}
+
+    void on_container_start(proton::container& c) override {
+        proton::target_options opts;
+        std::map<proton::symbol,proton::value> 
m({{proton::symbol("supported-dist-modes"), proton::value("move")}});

Review comment:
       As above - maybe it would be better to have constants for move and copy 
symbols that can be used in this code to avoid repeating 
```proton::value(proton::symbol("move"))``` etc. actually perhaps 
```proton::symbol("move")``` may be enough as I think it should automatically 
convert to ```proton::value``




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [cpp] Add support for setting Dynamic Node Properties
> -----------------------------------------------------
>
>                 Key: PROTON-2308
>                 URL: https://issues.apache.org/jira/browse/PROTON-2308
>             Project: Qpid Proton
>          Issue Type: Improvement
>          Components: cpp-binding
>    Affects Versions: proton-c-0.33.0
>            Reporter: James Henry
>            Assignee: Rakhi Kumari
>            Priority: Major
>              Labels: api-addition
>
> Requesting support for setting the dynamic node properties be added to the 
> source and target options.
> This would allow the setting of termini node properties for senders and 
> receivers.
> Similar to the following request made for Python here: 
> https://issues.apache.org/jira/browse/PROTON-816



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to