blob: e7231ec45a67974dd9744a17a55a88cb7b3f9151 [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)
Dimitrios Mavrommatis6d4d5ce2017-12-13 11:35:55 -080018 frontend.bind("tcp://*: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)
Dimitrios Mavrommatis6d4d5ce2017-12-13 11:35:55 -080024 backend.bind("tcp://*: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__":
38 main()