blob: 8fe69da92ecf2f4c355889f83d6d93c8205e83a5 [file] [log] [blame]
David Reiss9f3296b2010-08-31 16:58:41 +00001#include "zmq.hpp"
2#include "TZmqServer.h"
3#include "Storage.h"
4
5using boost::shared_ptr;
6using apache::thrift::TProcessor;
7using apache::thrift::server::TZmqServer;
8using apache::thrift::server::TZmqMultiServer;
9
10class StorageHandler : virtual public StorageIf {
11 public:
12 StorageHandler()
13 : value_(0)
14 {}
15
16 void incr(const int32_t amount) {
17 value_ += amount;
18 printf("value_: %i\n", value_) ;
19 }
20
21 int32_t get() {
22 return value_;
23 }
24
25 private:
26 int32_t value_;
27
28};
29
30
31int main(int argc, char *argv[]) {
32 shared_ptr<StorageHandler> handler(new StorageHandler());
33 shared_ptr<TProcessor> processor(new StorageProcessor(handler));
34
35 zmq::context_t ctx(1);
36 TZmqServer oneway_server(processor, ctx, "epgm://eth0;239.192.1.1:5555", ZMQ_SUB);
37 oneway_server.serve();
38
39 return 0;
40}