diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/jaegertracing/thrift/contrib/zeromq/test-server.py | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | src/jaegertracing/thrift/contrib/zeromq/test-server.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/jaegertracing/thrift/contrib/zeromq/test-server.py b/src/jaegertracing/thrift/contrib/zeromq/test-server.py new file mode 100755 index 000000000..d89b37ba2 --- /dev/null +++ b/src/jaegertracing/thrift/contrib/zeromq/test-server.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +import zmq +import TZmqServer +import storage.ttypes +import storage.Storage + + +class StorageHandler(storage.Storage.Iface): + def __init__(self): + self.value = 0 + + def incr(self, amount): + self.value += amount + + def get(self): + return self.value + + +def main(): + handler = StorageHandler() + processor = storage.Storage.Processor(handler) + + 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.PULL) + multiserver = TZmqServer.TZmqMultiServer() + multiserver.servers.append(reqrep_server) + multiserver.servers.append(oneway_server) + multiserver.serveForever() + + +if __name__ == "__main__": + main() |