/** * Send a String. * * @param msg the message to send, as a String. * @return true if send was successful, false otherwise. */ public boolean sendMore(String msg) { byte[] b = msg.getBytes(); return send(b, 0, b.length, SNDMORE); }
/** * Send a String. * * @param msg the message to send, as a String. * @return true if send was successful, false otherwise. */ public boolean send(String msg) { byte[] b = msg.getBytes(); return send(b, 0, b.length, 0); }
/** * Send a String. * * @param msg the message to send, as a String. * @param flags the flags to apply to the send operation. * @return true if send was successful, false otherwise. */ public boolean send(String msg, int flags) { byte[] b = msg.getBytes(); return send(b, 0, b.length, flags); }
public void publish(byte[] message) { if (socket == null) { return; } // single frame message socket.send(message, 0); }
public boolean send(String data, ZMQ.Socket socket) { if (data != null && socket != null) socket.send(data); return true; }
@Override public void processTuple(byte[] tuple) { publisher.send(tuple, 0); } }
private void code(int type, int code) { worker.sendMore(new byte[] {(byte) type}); if (code == ZPConstants.STATUS_OK) worker.sendMore(new byte[] {(byte) code}); else worker.send(new byte[] {(byte) code}); } }
/** * necessary for publisher side to synchronize publisher and subscriber, must run after setup() * make sure subscribers all connected to the publisher, then the publisher send data after that */ public void startSyncJob() { for (int subscribers = 0; subscribers < SUBSCRIBERS_EXPECTED; subscribers++) { syncservice.recv(0); syncservice.send("".getBytes(), 0); } syncStarted = true; }
@Override public boolean send(String word, boolean more) { if (locked) { return false; } return pipe.send(word, more ? ZMQ.SNDMORE : 0); }
public void send(Object message) { String msg = message.toString(); publisher.send(msg.getBytes(), 0); }
@Override public void start(Socket pipe, List<Socket> sockets, ZPoller poller) { pipe.send("STARTED"); }
@Override public void processTuple(byte[] tuple) { publisher.send(tuple, 0); } }
@Override public void run() { while (true) { try { String message = queue.take(); socket.send(message); } catch (InterruptedException e) { logger.warn("state publisher interrupted"); return; } } }
public void publish(Object message) { publisher.sendMore(topicName); String msg = Tools.serialize(mapper, message); if (msg != null) publisher.send(msg); else System.err.println("No publish:" + message); }
@Override public boolean send(String word) { if (locked) { return false; } return pipe.send(word); }
/** * Send a message. * * @param msg the message to send, as an array of bytes. * @param flags the flags to apply to the send operation. * @return true if send was successful, false otherwise. */ public boolean send(byte[] msg, int flags) { return send(msg, 0, msg.length, flags); }
/** * Send a message. * * @param msg the message to send, as an array of bytes. * @param offset the offset of the message to send. * @param flags the flags to apply to the send operation. * @return true if send was successful, false otherwise. */ public boolean send(byte[] msg, int offset, int flags) { return send(msg, offset, msg.length, flags); }
public static Socket send(Socket socket, byte[] message, int flags) { socket.send(message, flags); return socket; }
private void handleHeartbeat() { byte[] buffer = hearbeatSocket.recv(0); hearbeatSocket.send(buffer); }