Created
December 15, 2010 14:43
-
-
Save gaubert/742013 to your computer and use it in GitHub Desktop.
0MQ msgqueue.py zguide implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple message queuing broker | |
Same as request-reply broker but using QUEUE device | |
Author: Guillaume Aubert (gaubert) <guillaume(dot)aubert(at)gmail(dot)com> | |
""" | |
import zmq | |
def main(): | |
""" main method """ | |
context = zmq.Context(1) | |
# Socket facing clients | |
frontend = context.socket(zmq.XREP) | |
frontend.bind("tcp://*:5559") | |
# Socket facing services | |
backend = context.socket(zmq.XREQ) | |
backend.bind("tcp://*:5560") | |
zmq.device(zmq.QUEUE, frontend, backend) | |
# We never get here... | |
frontend.close() | |
backend.close() | |
context.term() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment