blob: 04f2a187148d4b0b4e1b82a05bea6a29aa64335a [file] [log] [blame]
Dimitrios Mavrommatisc53923a2017-12-03 19:48:48 -08001#!/usr/bin/python
2# coding: utf8
3#Copyright © 2016 - 2017 Copyright (c) Sprint, Inc. and others. All rights reserved.
4#
5#This program and the accompanying materials are made available under the
6#terms of the Eclipse Public License v1.0 which accompanies this distribution,
7#and is available at http://www.eclipse.org/legal/epl-v10.html
8
9import zmq
10
11def main():
12
13 try:
14 context = zmq.Context(1)
15
16 # Socket facing clients
17 frontend = context.socket(zmq.SUB)
18 frontend.bind("tcp://*:5559")
19
20 frontend.setsockopt(zmq.SUBSCRIBE, "")
21
22 # Socket facing services
23 backend = context.socket(zmq.PUB)
24 backend.bind("tcp://*:5560")
25
26
27 zmq.device(zmq.FORWARDER, frontend, backend)
28 except Exception, e:
29 print e
30 print "bringing down zmq device"
31 finally:
32 pass
33 frontend.close()
34 backend.close()
35 context.term()
36
37if __name__ == "__main__":
38 main()