diff options
author | Stefan Bolus <stefan.bolus@gmx.de> | 2018-05-14 14:48:09 +0200 |
---|---|---|
committer | James E. King III <jking@apache.org> | 2018-05-14 08:48:09 -0400 |
commit | e59b73d3c2bf1c328ccb78e683c0462fa1a473c7 (patch) | |
tree | 0e1abbf1b4e8b3192f038762f4fa1857c3d611ec /contrib | |
parent | 336d4ecddfc8aa687ec5cd1bc3ff4455b11da451 (diff) | |
download | thrift-e59b73d3c2bf1c328ccb78e683c0462fa1a473c7.tar.gz |
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.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/zeromq/Makefile | 2 | ||||
-rw-r--r-- | contrib/zeromq/TZmqServer.cpp | 2 | ||||
-rw-r--r-- | contrib/zeromq/TZmqServer.h | 4 | ||||
-rw-r--r-- | contrib/zeromq/test-client.cpp | 4 | ||||
-rwxr-xr-x | contrib/zeromq/test-client.py | 2 | ||||
-rw-r--r-- | contrib/zeromq/test-receiver.cpp | 2 | ||||
-rw-r--r-- | contrib/zeromq/test-sender.cpp | 2 | ||||
-rw-r--r-- | contrib/zeromq/test-server.cpp | 4 | ||||
-rwxr-xr-x | contrib/zeromq/test-server.py | 2 |
9 files changed, 12 insertions, 12 deletions
diff --git a/contrib/zeromq/Makefile b/contrib/zeromq/Makefile index b09f4ee34..ee398e22c 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 f03145885..4df6c9237 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 a840c8646..43f86c084 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 d2fc56ce1..70a331ed5 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 55c23e0a0..d51216e45 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 8fe69da92..60791ac72 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 6b0eef156..8928db390 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 c624b0d8d..baa1451dd 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 c7804d317..d89b37ba2 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) |