Created
January 24, 2014 15:00
-
-
Save drocco007/8598882 to your computer and use it in GitHub Desktop.
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
# ∅MQ multi-publisher message bus | |
# | |
# modeled on http://zguide.zeromq.org/py:msgqueue but with XPUB/XSUB instead | |
# of ROUTER/DEALER | |
# | |
# usage: julia bus.jl <inbound_port> <outbound_port> | |
# | |
using ZMQ | |
context = Context(1) | |
bus_in = Socket(context, ZMQ.XSUB) | |
bus_out = Socket(context, ZMQ.XPUB) | |
ZMQ.bind(bus_in, "tcp://*:$(ARGS[1])") | |
ZMQ.bind(bus_out, "tcp://*:$(ARGS[2])") | |
# zmq_device(FORWARDER, bus_in, bus_out) | |
ccall( (:zmq_device, "libzmq"), Int64, (Int64, Socket, Socket), | |
FORWARDER, bus_in, bus_out) | |
# shouldn't get here | |
ZMQ.close(bus_in) | |
ZMQ.close(bus_out) | |
ZMQ.close(context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment