asimov.tcpros
handler-fn
(handler-fn node)
Returns a handler function that accepts and establishes
publishing tcpros connections with other nodes.
Expects:
node:atom The node the incomming connections should be connected to.
Returns the handler function to be used with an aleph tcp server.
listen!
(listen! node)
Starts an aleph tcp server on a random port that waits for
incomming subscription to topics of the provided node.
Expects:
node:atom the node incomming connections are registered on.
Returns a map containing a function to stop the server as well as the randomly choosen port.
Throws an exception if no free port can be found after 1000 retries.
rand-port
(rand-port)
Returns a random port in the ephemeral port range.
subscribe!
(subscribe! addr callerid topic msg-def)
Establishes a subscribing tcpros connection with another node.
Expects:
addr:map The address map describing the node to be connected to.
callerid:string A string identifying the connecting node.
topic:string The name of the topic to be subscribed to.
Returns a channel delivering messages from the node connected to.