示例#1
0
func railToRouterDealer(rail *Rail, poller *zmq.Poller) (ingress *zmq.Socket, egress *zmq.Socket) {
	// CREATE EACH SOCKET...
	ingress = newSocket(zmq.ROUTER)

	egress = newSocket(zmq.DEALER)
	egress.SetLinger(1)

	// ... AND BIND
	bind(ingress, "tcp", "0.0.0.0", rail.Ingress)
	bind(egress, "tcp", "0.0.0.0", rail.Egress)

	poller.Add(ingress, zmq.POLLIN)
	poller.Add(egress, zmq.POLLIN)
	return
}
示例#2
0
func railToPubSub(rail *Rail, poller *zmq.Poller) (ingress *zmq.Socket, egress *zmq.Socket) {
	// CREATE EACH SOCKET...
	ingress = newSocket(zmq.SUB)
	ingress.SetSubscribe("")

	egress = newSocket(zmq.PUB)
	egress.SetLinger(1)

	// ... AND BIND
	bind(ingress, "tcp", "0.0.0.0", rail.Ingress)
	bind(egress, "tcp", "0.0.0.0", rail.Egress)

	poller.Add(ingress, zmq.POLLIN)
	return
}