THRIFT-812. contrib: Add a demo of using Thrift over ZeroMQ
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991260 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/contrib/zeromq/test-sender.cpp b/contrib/zeromq/test-sender.cpp
new file mode 100644
index 0000000..ca05709
--- /dev/null
+++ b/contrib/zeromq/test-sender.cpp
@@ -0,0 +1,32 @@
+#include <iostream>
+#include <cstdlib>
+#include <protocol/TBinaryProtocol.h>
+
+#include "zmq.hpp"
+#include "TZmqClient.h"
+#include "Storage.h"
+
+using boost::shared_ptr;
+using apache::thrift::transport::TZmqClient;
+using apache::thrift::protocol::TBinaryProtocol;
+
+int main(int argc, char** argv) {
+ const char* endpoint = "epgm://eth0;239.192.1.1:5555";
+ int socktype = ZMQ_PUB;
+ int incr = 1;
+ if (argc > 1) {
+ incr = atoi(argv[1]);
+ }
+
+ zmq::context_t ctx(1);
+ shared_ptr<TZmqClient> transport(new TZmqClient(ctx, endpoint, socktype));
+ shared_ptr<TBinaryProtocol> protocol(new TBinaryProtocol(transport));
+ StorageClient client(protocol);
+
+ transport->open();
+
+ client.incr(incr);
+ usleep(50000);
+
+ return 0;
+}