qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject qpid-proton git commit: NO-JIRA: c++: rename sync_request_response to request_response
Date Mon, 19 Oct 2015 16:47:22 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master ea52a2742 -> abea588a4


NO-JIRA: c++: rename sync_request_response to request_response


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/abea588a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/abea588a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/abea588a

Branch: refs/heads/master
Commit: abea588a4da7be36820974f0ebedf3ac6d634f46
Parents: ea52a27
Author: Alan Conway <aconway@redhat.com>
Authored: Fri Oct 2 17:10:39 2015 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Mon Oct 19 12:45:24 2015 -0400

----------------------------------------------------------------------
 examples/cpp/example_test.py                    |  2 +-
 examples/cpp/sync_client.cpp                    |  4 +-
 proton-c/bindings/cpp/CMakeLists.txt            |  2 +-
 proton-c/bindings/cpp/docs/tutorial.hpp         |  2 +-
 .../cpp/include/proton/blocking_connection.hpp  |  2 +-
 .../cpp/include/proton/request_response.hpp     | 63 ++++++++++++++++++++
 .../include/proton/sync_request_response.hpp    | 63 --------------------
 proton-c/bindings/cpp/src/request_response.cpp  | 57 ++++++++++++++++++
 .../bindings/cpp/src/sync_request_response.cpp  | 57 ------------------
 9 files changed, 126 insertions(+), 126 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/abea588a/examples/cpp/example_test.py
----------------------------------------------------------------------
diff --git a/examples/cpp/example_test.py b/examples/cpp/example_test.py
index cc27a1f..bb40265 100644
--- a/examples/cpp/example_test.py
+++ b/examples/cpp/example_test.py
@@ -178,7 +178,7 @@ class ExampleTest(unittest.TestCase):
         finally:
             server.kill()
 
-    def test_sync_request_response(self):
+    def test_request_response(self):
         b = Broker.get()
         server = background("server", "-a", b.addr)
         try:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/abea588a/examples/cpp/sync_client.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/sync_client.cpp b/examples/cpp/sync_client.cpp
index 39bdabf..9493579 100644
--- a/examples/cpp/sync_client.cpp
+++ b/examples/cpp/sync_client.cpp
@@ -23,7 +23,7 @@
 
 #include "proton/container.hpp"
 #include "proton/blocking_connection.hpp"
-#include "proton/sync_request_response.hpp"
+#include "proton/request_response.hpp"
 #include "proton/url.hpp"
 #include "proton/types.hpp"
 
@@ -50,7 +50,7 @@ int main(int argc, char **argv) {
         opts.parse();
 
         proton::blocking_connection conn(url, proton::duration(timeout));
-        proton::sync_request_response client(conn, url.path());
+        proton::request_response client(conn, url.path());
         for (std::vector<std::string>::const_iterator i=requests.begin(); i != requests.end();
i++) {
             proton::message request;
             request.body(*i);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/abea588a/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 45e47b2..9f423fb 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -59,7 +59,7 @@ set(qpid-proton-cpp-source
   src/receiver.cpp
   src/sender.cpp
   src/session.cpp
-  src/sync_request_response.cpp
+  src/request_response.cpp
   src/task.cpp
   src/terminus.cpp
   src/transport.cpp

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/abea588a/proton-c/bindings/cpp/docs/tutorial.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/docs/tutorial.hpp b/proton-c/bindings/cpp/docs/tutorial.hpp
index cae3745..bc5b758 100644
--- a/proton-c/bindings/cpp/docs/tutorial.hpp
+++ b/proton-c/bindings/cpp/docs/tutorial.hpp
@@ -396,7 +396,7 @@ server or mixed client-server programs. However for simple client-only
programs
 a synchronous or blocking style of programming is sometimes simpler.
 
 `proton::blocking_connection` allows a blocking style of programming,
-`proton::sync_request_response` automates the common case of synchronous
+`proton::request_response` automates the common case of synchronous
 request/response, send a request and block for the response.
 
 \ref sync_client.cpp is our request/response client in blocking style. Here's the key section

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/abea588a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp b/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
index d6db1e2..f7787cb 100644
--- a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
@@ -54,7 +54,7 @@ class blocking_connection
   friend class blocking_link;
   friend class blocking_sender;
   friend class blocking_receiver;
-  friend class sync_request_response;
+  friend class request_response;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/abea588a/proton-c/bindings/cpp/include/proton/request_response.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/request_response.hpp b/proton-c/bindings/cpp/include/proton/request_response.hpp
new file mode 100644
index 0000000..9bc4392
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/request_response.hpp
@@ -0,0 +1,63 @@
+#ifndef PROTON_CPP_SYNC_REQUEST_RESPONSE_H
+#define PROTON_CPP_SYNC_REQUEST_RESPONSE_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "proton/blocking_receiver.hpp"
+#include "proton/blocking_sender.hpp"
+#include "proton/export.hpp"
+#include "proton/messaging_handler.hpp"
+#include "proton/pn_unique_ptr.hpp"
+
+#include <string>
+
+struct pn_message_t;
+struct pn_data_t;
+
+namespace proton {
+
+/**
+ * An implementation of the synchronous request-response pattern (aka RPC).
+ */
+class request_response
+{
+  public:
+    PN_CPP_EXTERN request_response(
+        blocking_connection &, const std::string address=std::string());
+    /**
+     * Send a request message, wait for and return the response message.
+     * Modifies the message to set `address` (if not already set), `reply_to` and `correlation_id`.
+     */
+    PN_CPP_EXTERN message call(message &request);
+    /** Return the dynamic address of our receiver. */
+    PN_CPP_EXTERN std::string reply_to();
+
+  private:
+    blocking_connection &connection_;
+    std::string address_;
+    pn_unique_ptr<blocking_sender> sender_;
+    pn_unique_ptr<blocking_receiver> receiver_;
+    amqp_ulong correlation_id_;
+};
+
+}
+
+#endif  /*!PROTON_CPP_SYNC_REQUEST_RESPONSE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/abea588a/proton-c/bindings/cpp/include/proton/sync_request_response.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/sync_request_response.hpp b/proton-c/bindings/cpp/include/proton/sync_request_response.hpp
deleted file mode 100644
index d5bfb59..0000000
--- a/proton-c/bindings/cpp/include/proton/sync_request_response.hpp
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef PROTON_CPP_SYNC_REQUEST_RESPONSE_H
-#define PROTON_CPP_SYNC_REQUEST_RESPONSE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "proton/blocking_receiver.hpp"
-#include "proton/blocking_sender.hpp"
-#include "proton/export.hpp"
-#include "proton/messaging_handler.hpp"
-#include "proton/pn_unique_ptr.hpp"
-
-#include <string>
-
-struct pn_message_t;
-struct pn_data_t;
-
-namespace proton {
-
-/**
- * An implementation of the synchronous request-response pattern (aka RPC).
- */
-class sync_request_response
-{
-  public:
-    PN_CPP_EXTERN sync_request_response(
-        blocking_connection &, const std::string address=std::string());
-    /**
-     * Send a request message, wait for and return the response message.
-     * Modifies the message to set `address` (if not already set), `reply_to` and `correlation_id`.
-     */
-    PN_CPP_EXTERN message call(message &request);
-    /** Return the dynamic address of our receiver. */
-    PN_CPP_EXTERN std::string reply_to();
-
-  private:
-    blocking_connection &connection_;
-    std::string address_;
-    pn_unique_ptr<blocking_sender> sender_;
-    pn_unique_ptr<blocking_receiver> receiver_;
-    amqp_ulong correlation_id_;
-};
-
-}
-
-#endif  /*!PROTON_CPP_SYNC_REQUEST_RESPONSE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/abea588a/proton-c/bindings/cpp/src/request_response.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/request_response.cpp b/proton-c/bindings/cpp/src/request_response.cpp
new file mode 100644
index 0000000..9b8207c
--- /dev/null
+++ b/proton-c/bindings/cpp/src/request_response.cpp
@@ -0,0 +1,57 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "proton/blocking_connection.hpp"
+#include "proton/request_response.hpp"
+#include "proton/event.hpp"
+#include "proton/error.hpp"
+#include "proton/value.hpp"
+#include "blocking_connection_impl.hpp"
+#include "msg.hpp"
+
+namespace proton {
+
+request_response::request_response(blocking_connection &conn, const std::string addr):
+    connection_(conn), address_(addr),
+    sender_(new blocking_sender(connection_, addr)),
+    receiver_(new blocking_receiver(connection_, "", 1/*credit*/, true/*dynamic*/)),
+    correlation_id_(0)
+{}
+
+message request_response::call(message &request) {
+    if (address_.empty() && request.address().empty())
+        throw error(MSG("Request message has no address"));
+    // TODO: atomic increment.
+    value cid(++correlation_id_);
+    request.correlation_id(cid);
+    request.reply_to(this->reply_to());
+    sender_->send(request);
+    message response;
+    while (response.correlation_id() != cid) {
+        response = receiver_->receive();
+    }
+    return response;
+}
+
+std::string request_response::reply_to() {
+    return receiver_->receiver().remote_source().address();
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/abea588a/proton-c/bindings/cpp/src/sync_request_response.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/sync_request_response.cpp b/proton-c/bindings/cpp/src/sync_request_response.cpp
deleted file mode 100644
index 69249c7..0000000
--- a/proton-c/bindings/cpp/src/sync_request_response.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "proton/blocking_connection.hpp"
-#include "proton/sync_request_response.hpp"
-#include "proton/event.hpp"
-#include "proton/error.hpp"
-#include "proton/value.hpp"
-#include "blocking_connection_impl.hpp"
-#include "msg.hpp"
-
-namespace proton {
-
-sync_request_response::sync_request_response(blocking_connection &conn, const std::string
addr):
-    connection_(conn), address_(addr),
-    sender_(new blocking_sender(connection_, addr)),
-    receiver_(new blocking_receiver(connection_, "", 1/*credit*/, true/*dynamic*/)),
-    correlation_id_(0)
-{}
-
-message sync_request_response::call(message &request) {
-    if (address_.empty() && request.address().empty())
-        throw error(MSG("Request message has no address"));
-    // TODO: atomic increment.
-    value cid(++correlation_id_);
-    request.correlation_id(cid);
-    request.reply_to(this->reply_to());
-    sender_->send(request);
-    message response;
-    while (response.correlation_id() != cid) {
-        response = receiver_->receive();
-    }
-    return response;
-}
-
-std::string sync_request_response::reply_to() {
-    return receiver_->receiver().remote_source().address();
-}
-
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message