blob: 5c4b8a5e4a21a6d1ed62e3eb8c42dd726f766445 [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)
slowrdde30ad2017-12-21 14:16:04 -050018 frontend.bind("tcp://192.168.105.14:5555")
Dimitrios Mavrommatisc53923a2017-12-03 19:48:48 -080019
20 frontend.setsockopt(zmq.SUBSCRIBE, "")
21
22 # Socket facing services
23 backend = context.socket(zmq.PUB)
slowrdde30ad2017-12-21 14:16:04 -050024 backend.bind("tcp://192.168.105.14:5556")
Dimitrios Mavrommatisc53923a2017-12-03 19:48:48 -080025
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__":
slowrdde30ad2017-12-21 14:16:04 -050038 main()