You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2018/05/14 12:48:15 UTC

[thrift] branch master updated: THRIFT-4571: Updated ZeroMQ examples to ZeroMQ version >= 3.0. (#1556)

This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new e59b73d  THRIFT-4571: Updated ZeroMQ examples to ZeroMQ version >= 3.0. (#1556)
e59b73d is described below

commit e59b73d3c2bf1c328ccb78e683c0462fa1a473c7
Author: Stefan Bolus <st...@gmx.de>
AuthorDate: Mon May 14 14:48:09 2018 +0200

    THRIFT-4571: Updated ZeroMQ examples to ZeroMQ version >= 3.0. (#1556)
    
    * New style for Python is default now.
    * Symbols were replaced in newer versions of ZeroMQ (>=3.0).
    * Use Thrift's abstraction for `shared_ptr` instead of Boost.
    * Symbols were replaced in Python as well.
---
 contrib/zeromq/Makefile          | 2 +-
 contrib/zeromq/TZmqServer.cpp    | 2 +-
 contrib/zeromq/TZmqServer.h      | 4 ++--
 contrib/zeromq/test-client.cpp   | 4 ++--
 contrib/zeromq/test-client.py    | 2 +-
 contrib/zeromq/test-receiver.cpp | 2 +-
 contrib/zeromq/test-sender.cpp   | 2 +-
 contrib/zeromq/test-server.cpp   | 4 ++--
 contrib/zeromq/test-server.py    | 2 +-
 9 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/contrib/zeromq/Makefile b/contrib/zeromq/Makefile
index b09f4ee..ee398e2 100644
--- a/contrib/zeromq/Makefile
+++ b/contrib/zeromq/Makefile
@@ -26,7 +26,7 @@ test-client.o test-server.o test-sender.o test-receiver.o: $(GENSRCS)
 
 storage/__init__.py: storage.thrift
 	$(RM) $(dir $@)
-	$(THRIFT) --gen py:newstyle $<
+	$(THRIFT) --gen py $<
 	mv gen-py/$(dir $@) .
 
 $(GENSRCS): storage.thrift
diff --git a/contrib/zeromq/TZmqServer.cpp b/contrib/zeromq/TZmqServer.cpp
index f031458..4df6c92 100644
--- a/contrib/zeromq/TZmqServer.cpp
+++ b/contrib/zeromq/TZmqServer.cpp
@@ -21,7 +21,7 @@
 #include <thrift/transport/TBufferTransports.h>
 #include <boost/scoped_ptr.hpp>
 
-using boost::shared_ptr;
+using apache::thrift::stdcxx::shared_ptr;
 using apache::thrift::transport::TMemoryBuffer;
 using apache::thrift::protocol::TProtocol;
 
diff --git a/contrib/zeromq/TZmqServer.h b/contrib/zeromq/TZmqServer.h
index a840c86..43f86c0 100644
--- a/contrib/zeromq/TZmqServer.h
+++ b/contrib/zeromq/TZmqServer.h
@@ -28,7 +28,7 @@ namespace apache { namespace thrift { namespace server {
 class TZmqServer : public TServer {
  public:
   TZmqServer(
-      boost::shared_ptr<TProcessor> processor,
+      apache::thrift::stdcxx::shared_ptr<TProcessor> processor,
       zmq::context_t& ctx, const std::string& endpoint, int type)
     : TServer(processor)
     , processor_(processor)
@@ -56,7 +56,7 @@ class TZmqServer : public TServer {
   }
 
  private:
-  boost::shared_ptr<TProcessor> processor_;
+  apache::thrift::stdcxx::shared_ptr<TProcessor> processor_;
   int zmq_type_;
   zmq::socket_t sock_;
 };
diff --git a/contrib/zeromq/test-client.cpp b/contrib/zeromq/test-client.cpp
index d2fc56c..70a331e 100644
--- a/contrib/zeromq/test-client.cpp
+++ b/contrib/zeromq/test-client.cpp
@@ -6,7 +6,7 @@
 #include "TZmqClient.h"
 #include "Storage.h"
 
-using boost::shared_ptr;
+using apache::thrift::stdcxx::shared_ptr;
 using apache::thrift::transport::TZmqClient;
 using apache::thrift::protocol::TBinaryProtocol;
 
@@ -17,7 +17,7 @@ int main(int argc, char** argv) {
   if (argc > 1) {
     incr = atoi(argv[1]);
     if (incr) {
-      socktype = ZMQ_DOWNSTREAM;
+      socktype = ZMQ_PUSH;
       endpoint = "tcp://127.0.0.1:9091";
     }
   }
diff --git a/contrib/zeromq/test-client.py b/contrib/zeromq/test-client.py
index 55c23e0..d51216e 100755
--- a/contrib/zeromq/test-client.py
+++ b/contrib/zeromq/test-client.py
@@ -15,7 +15,7 @@ def main(args):
     if len(args) > 1:
         incr = int(args[1])
         if incr:
-            socktype = zmq.DOWNSTREAM
+            socktype = zmq.PUSH
             endpoint = "tcp://127.0.0.1:9091"
 
     ctx = zmq.Context()
diff --git a/contrib/zeromq/test-receiver.cpp b/contrib/zeromq/test-receiver.cpp
index 8fe69da..60791ac 100644
--- a/contrib/zeromq/test-receiver.cpp
+++ b/contrib/zeromq/test-receiver.cpp
@@ -2,7 +2,7 @@
 #include "TZmqServer.h"
 #include "Storage.h"
 
-using boost::shared_ptr;
+using apache::thrift::stdcxx::shared_ptr;
 using apache::thrift::TProcessor;
 using apache::thrift::server::TZmqServer;
 using apache::thrift::server::TZmqMultiServer;
diff --git a/contrib/zeromq/test-sender.cpp b/contrib/zeromq/test-sender.cpp
index 6b0eef1..8928db3 100644
--- a/contrib/zeromq/test-sender.cpp
+++ b/contrib/zeromq/test-sender.cpp
@@ -6,7 +6,7 @@
 #include "TZmqClient.h"
 #include "Storage.h"
 
-using boost::shared_ptr;
+using apache::thrift::stdcxx::shared_ptr;
 using apache::thrift::transport::TZmqClient;
 using apache::thrift::protocol::TBinaryProtocol;
 
diff --git a/contrib/zeromq/test-server.cpp b/contrib/zeromq/test-server.cpp
index c624b0d..baa1451 100644
--- a/contrib/zeromq/test-server.cpp
+++ b/contrib/zeromq/test-server.cpp
@@ -2,7 +2,7 @@
 #include "TZmqServer.h"
 #include "Storage.h"
 
-using boost::shared_ptr;
+using apache::thrift::stdcxx::shared_ptr;
 using apache::thrift::TProcessor;
 using apache::thrift::server::TZmqServer;
 using apache::thrift::server::TZmqMultiServer;
@@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
 
   zmq::context_t ctx(1);
   TZmqServer reqrep_server(processor, ctx, "tcp://0.0.0.0:9090", ZMQ_REP);
-  TZmqServer oneway_server(processor, ctx, "tcp://0.0.0.0:9091", ZMQ_UPSTREAM);
+  TZmqServer oneway_server(processor, ctx, "tcp://0.0.0.0:9091", ZMQ_PULL);
   TZmqMultiServer multiserver;
   multiserver.servers().push_back(&reqrep_server);
   multiserver.servers().push_back(&oneway_server);
diff --git a/contrib/zeromq/test-server.py b/contrib/zeromq/test-server.py
index c7804d3..d89b37b 100755
--- a/contrib/zeromq/test-server.py
+++ b/contrib/zeromq/test-server.py
@@ -22,7 +22,7 @@ def main():
 
     ctx = zmq.Context()
     reqrep_server = TZmqServer.TZmqServer(processor, ctx, "tcp://0.0.0.0:9090", zmq.REP)
-    oneway_server = TZmqServer.TZmqServer(processor, ctx, "tcp://0.0.0.0:9091", zmq.UPSTREAM)
+    oneway_server = TZmqServer.TZmqServer(processor, ctx, "tcp://0.0.0.0:9091", zmq.PULL)
     multiserver = TZmqServer.TZmqMultiServer()
     multiserver.servers.append(reqrep_server)
     multiserver.servers.append(oneway_server)

-- 
To stop receiving notification emails like this one, please contact
jking@apache.org.