private ZMQ.Socket getNewSocket(int type, int port, String connection, ZMQ.Context context) { ZMQ.Socket socket = context.socket(type); socket.bind(connection + ":" + String.valueOf(port)); return socket; }
@Override public List<String> call() throws Exception { try (ZMQ.Socket subscriber = context.socket(ZMQ.SUB)) { subscriber.connect(endpoint); subscriber.subscribe(new byte[0]); for (int messageNum = 0; messageNum < receiveCount && !Thread.currentThread().isInterrupted(); messageNum++) { // Use trim to remove the tailing '0' character messages.add(subscriber.recvStr(0).trim()); } } return messages; } }
ZMQ.Socket socket = ctx.socket(socketType); socket.connect(addr);
@Init public void init() { // Windows requires the ZMQ library to be loaded as the JZMQ library is linked to it and Windows is unable to resolve it relative to the JZMQ library // System.loadLibrary("zmq"); ZMQLibraryInitializer.loadLibrary(hostInfo); context = ZMQ.context(1); controlSocket = context.socket(ZMQ.PUB); controlSocket.bind("inproc://fabric3"); }
public ZMQ.Socket createControlSocket() { ZMQ.Socket controlSocket = context.socket(ZMQ.SUB); controlSocket.subscribe(EMPTY_BYTES); controlSocket.connect("inproc://fabric3"); return controlSocket; }
@ManagementOperation(type = OperationType.POST) public void start() { manager.reserve(id); socket = manager.getContext().socket(ZMQ.PUB); SocketHelper.configure(socket, metadata); address.getPort().bind(Port.TYPE.TCP); socket.bind(address.toProtocolString()); }
private void initZeroMq() { context = ZMQ.context(threadNum); socket = context.socket(ZMQ.PUSH); socket.connect("tcp://" + getServername() + ":" + getPort()); }
@Override public void prepare() { ZMQ.Context context = ZMQ.context(1); publisher = context.socket(ZMQ.PUB); publisher.bind("tcp://*:5563"); }
@Override public void setup(Context.OperatorContext ctx) { context = ZMQ.context(1); sock = context.socket(ZMQ.PULL); sock.connect(zmqAddress); }
@ManagementOperation(type = OperationType.POST) public void start() { manager.reserve(id); socket = manager.getContext().socket(ZMQ.PUB); SocketHelper.configure(socket, metadata); address.getPort().bind(Port.TYPE.TCP); socket.bind(address.toProtocolString()); }
@Init public void init() { // Windows requires the ZMQ library to be loaded as the JZMQ library is linked to it and Windows is unable to resolve it relative to the JZMQ library // System.loadLibrary("zmq"); loadLibrary(hostInfo); context = ZMQ.context(1); controlSocket = context.socket(ZMQ.PUB); controlSocket.bind("inproc://fabric3"); }
@Override public void setup(Context.OperatorContext ctx) { context = ZMQ.context(1); sock = context.socket(ZMQ.PULL); sock.connect(zmqAddress); }
public ZMQ.Socket createControlSocket() { ZMQ.Socket controlSocket = context.socket(ZMQ.SUB); controlSocket.setLinger(0); controlSocket.subscribe(EMPTY_BYTES); controlSocket.connect("inproc://fabric3"); return controlSocket; }
public Subscriber(EventIF handler, String address) throws Exception { this.handler = handler; subscriber = context.socket(ZMQ.SUB); subscriber.connect(address); me = new Thread(this); me.start(); }
public StatePublisher(int port) { context = ZMQ.context(1); socket = context.socket(ZMQ.PUB); socket.bind("tcp://*:" + port); this.setDaemon(true); this.start(); }
public boolean SendData(byte[] data) { ZMsg msg = new ZMsg(); msg.add(data); ZMQ.Socket sendSocket = context.socket(ZMQ.PUSH); sendSocket.setIdentity("shim".getBytes()); sendSocket.connect(CONTROL_ADDRESS); send(msg, sendSocket); sendSocket.close(); return true; }
public static Socket socket(Context context, int type) { return context.socket(type); }