func ZmqReadPartN(s *zmq.Socket, n int, buf *[]byte) {
	more := true
	partN := 0
	for more {
		if partN == n {
			*buf, _ = s.RecvBytes(0)
		} else {
			_, _ = s.RecvBytes(0)  
		}
		partN++
		more, _ = s.GetRcvmore()
	}
}
ZmqReadPartN reads a multi-part message but only
writes the requested part into the provided buffer
package utils
import (
	"fmt"
	"log"
	"time"
	zmq "github.com/pebbe/zmq4"
)
func ZmqPubSubProxy(host string, portIn int, portOut int, logger *log.Logger) {
	xsub, _ := zmq.NewSocket(zmq.SUB)
	xpub, _ := zmq.NewSocket(zmq.PUB)
	defer xsub.Close()
	defer xpub.Close()
	addrIn := fmt.Sprintf("tcp://*:%d", portIn)
	addrOut := fmt.Sprintf("tcp://*:%d", portOut)
	logger.Println("ZMQ XSUB on", addrIn)
	xsub.Bind(addrIn)
	xsub.SetSubscribe("")
	logger.Println("ZMQ XPUB on", addrOut)
	xpub.Bind(addrOut)
	poller := zmq.NewPoller()
	poller.Add(xsub, zmq.POLLIN)
	for {
		sockets, _ := poller.Poll(5 * time.Second)
		for _, socket := range sockets {
			switch s := socket.Socket; s {
			case xsub:
				ZmqSendMulti(xpub, ZmqRecvMulti(s))
			}
		}
	}
}
func ZmqRecvMulti(s *zmq.Socket) []string {
	var msg []string
	more := true
	for more {
		part, _ := s.Recv(0)
		msg = append(msg, part)
		more, _ = s.GetRcvmore()
	}
	return msg
}