ThreadPool.getPool().execute(new Runnable() {
@Override
public void run() {
final String addr = receiverUrl.toString().replaceFirst(
"zmq:/?/?", "");
final Socket socket = ZMQ.getSocket(org.zeromq.ZMQ.PUSH);
try {
socket.connect(addr);
socket.send(zmqType, org.zeromq.ZMQ.SNDMORE);
socket.send(senderUrl, org.zeromq.ZMQ.SNDMORE);
socket.send(token, org.zeromq.ZMQ.SNDMORE);
socket.send(message, 0);
} catch (final Exception e) {
LOG.log(Level.WARNING, "Failed to send JSON through ZMQ", e);
}
socket.setTCPKeepAlive(-1);
socket.setLinger(-1);
socket.close();
}
});
}