Push message through pipe

@param pipe
Pipe
@param message
Message to push
@throws IOException
if message could not be written
198690
@SuppressWarnings("rawtypes")
    public void pushMessage(IPipe pipe, IMessage message) throws IOException {
        if (message instanceof RTMPMessage) {
            final IRTMPEvent msg = ((RTMPMessage) message).getBody();
            // get the type
            byte dataType = msg.getDataType();
            // get the timestamp
            int timestamp = msg.getTimestamp();
            log.trace("Data type: {} timestamp: {}", dataType, timestamp);
            // if writes are delayed, queue the data and sort it by time
            if (queue == null) {
                // if we plan to use a queue, create one
                queue = new PriorityQueue<QueuedMediaData>(queueThreshold <= 0 ? 11 : queueThreshold);
            }
            QueuedMediaData queued = null;
            if (msg instanceof IStreamData) {
                if (log.isTraceEnabled()) {
                    log.trace("Stream data, body saved. Data type: {} class type: {}", dataType, msg.getClass().getName());
                }
                // ensure that our first video frame written is a key frame
                if (msg instanceof VideoData) {
                    log.debug("pushMessage video - waitForVideoKeyframe: {} gotVideoKeyframe: {}", waitForVideoKeyframe, gotVideoKeyframe);
                    if (!gotVideoKeyframe) {
                        VideoData video = (VideoData) msg;
                        if (video.getFrameType() == FrameType.KEYFRAME) {
                            log.debug("Got our first keyframe");
                            gotVideoKeyframe = true;
                        }
                        if (waitForVideoKeyframe && !gotVideoKeyframe) {
                            // skip this frame bail out
                            log.debug("Skipping video data since keyframe has not been written yet");
                            return;
                        }
                    }
                }
                queued = new QueuedMediaData(timestamp, dataType, (IStreamData) msg);
            } else {
                // XXX what type of message are we saving that has no body data??
                if (log.isTraceEnabled()) {
                    log.trace("Non-stream data, body not saved. Data type: {} class type: {}", dataType, msg.getClass().getName());
                }
                queued = new QueuedMediaData(timestamp, dataType);
            }
            if (queued != null) {
                writeLock.lock();
                try {
                    // add to the queue
                    queue.add(queued);
                } finally {
                    writeLock.unlock();
                }
            }
            int queueSize = 0;
            readLock.lock();
            try {
                queueSize = queue.size();
            } finally {
                readLock.unlock();
            }
            // initialize a writer
            if (writer == null) {
                init();
                if (msg instanceof VideoData) {
                    writeQueuedDataSlice(createTimestampLimitedSlice(msg.getTimestamp()));
                } else if (queueThreshold >= 0 && queueSize >= queueThreshold) {
                    writeQueuedDataSlice(createFixedLengthSlice(queueThreshold / (100 / percentage)));
                }
            }
        } else if (message instanceof ResetMessage) {
            startTimestamp = -1;
        } else if (log.isDebugEnabled()) {
            log.debug("Ignoring pushed message: {}", message);
        }
    }
109517
public static void write(Message message, File toFile) {
    OutputStream out = null;
    try {
      out = new BufferedOutputStream(new FileOutputStream(toFile, false));
      message.writeTo(out);
    } catch (Exception e) {
      throw ContextException.of("Unable to write message", e).addContext("file", toFile);
    } finally {
      IOUtils.closeQuietly(out);
    }
  }
110093
public void print(PrintStream ps, String message){
        if(SUPPORTED)
            ps.print(start);
        ps.print(message);
        if(SUPPORTED)
            ps.print(END);
    }
395730
def write(self, message):
        
        try:
            self.socket.send(message.encode('utf-8') + b'\0')
        except socket.error:
            if not self._closed:
                raise BrokenPipeError

        return Future.succeed(None)
1061970
public void sendMessage(String message)
    throws ProcessException {
        try {
            JMSServices.getInstance().sendTextMessage(destination,
                    JMSDestinationNames.INTRA_MDW_EVENT_HANDLER_QUEUE, message, 0, null);
        } catch (Exception e) {
            throw new ProcessException(-1, e.getMessage(), e);
        }

    }
62929
public void handleMessage(T message) throws Fault {
        if (LOG.isLoggable(Level.FINEST)) {
            LOG.finest("FlowIdProducerOut Interceptor called. isOutbound: "
                    + MessageUtils.isOutbound(message) + ", isRequestor: "
                    + MessageUtils.isRequestor(message));
        }

        if (MessageUtils.isRequestor(message)) {
            handleRequestOut(message);
        } else {
            handleResponseOut(message);
        }

        // Don't write flowId for Oneway responses
        if (isOnewayResponse(message)) {
            return;
        }

        // write FlowId to HTTP and Soap layer
        String flowId = FlowIdHelper.getFlowId(message);
        FlowIdProtocolHeaderCodec.writeFlowId(message, flowId);
        FlowIdSoapCodec.writeFlowId(message, flowId);

    }
1039547
public static Pipe newPipe(MessageBufferInput in, boolean numeric) throws IOException
    {
        MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(in);
        return newPipe(unpacker, numeric);
    }
594201
public void sendMessage(String message) {
        EventBuilder eventBuilder = new EventBuilder().withMessage(message)
            .withLevel(Event.Level.INFO);
        sendEvent(eventBuilder);
    }
824076
public void sendMessage(String message)
    throws ProcessException {
        try {
            HttpHelper httpHelper = new HttpHelper(getURL(destination));
            httpHelper.post(message);
        } catch (Exception e) {
            throw new ProcessException(-1, e.getMessage(), e);
        }
    }
718852
@SuppressWarnings("incomplete-switch")
    public void onPipeConnectionEvent(PipeConnectionEvent event) {
        switch (event.getType()) {
            case CONSUMER_CONNECT_PUSH:
                if (event.getConsumer() == this) {
                    Map<String, Object> paramMap = event.getParamMap();
                    if (paramMap != null) {
                        mode = (String) paramMap.get("mode");
                    }
                }
                break;
        }
    }
777073
public function onPipeMessage($serv, $fromWorkerId, $message)
    {
        parent::onPipeMessage($serv, $fromWorkerId, $message);
        $data = unserialize($message);
        switch ($data['type']) {
            case Macro::MSG_TYPR_ASYN:
                $this->asynPoolManager->distribute($data['message']);
                break;
        }
    }
572121
public void setMessage(String message) {
    pushData.clear();
    Map<String, Object> map = AVUtils.createStringObjectMap("alert", message);
    pushData.put("data", map);
  }
1112358
protected void sendMessage (UpstreamMessage msg)
        throws IOException
    {
        if (debugLogMessages()) {
            log.info("SEND " + msg);
        }

        // first we write the message so that we can measure it's length
        _oout.writeObject(msg);
        _oout.flush();

        // then write the framed message to actual output stream
        try {
            ByteBuffer buffer = _fout.frameAndReturnBuffer();
            if (buffer.limit() > 4096) {
                String txt = StringUtil.truncate(String.valueOf(msg), 80, "...");
                log.info("Whoa, writin' a big one", "msg", txt, "size", buffer.limit());
            }
            int wrote = writeMessage(buffer);
            if (wrote != buffer.limit()) {
                log.warning("Aiya! Couldn't write entire message", "msg", msg,
                            "size", buffer.limit(), "wrote", wrote);
            } else {
//                 Log.info("Wrote " + wrote + " bytes.");
                _client.getMessageTracker().messageSent(false, wrote, msg);
            }

        } finally {
            _fout.resetFrame();
        }

        // make a note of our most recent write time
        updateWriteStamp();
    }
687871
public void sendMessage(Message message)
    {
        ((DualMessageQueue)this.getMessageQueue()).getMessageStack().sendMessage(message);
        
        ((BaseMessage)message).setProcessedByClient(true);     // Make sure any server doesn't send this back up.

        super.sendMessage(message);
    }
833929
public void pushMessages(List<Pair<K, V>> messages) {
    for (Pair<K, V> message: messages) {
      this.producer.send(new ProducerRecord<>(topic, message.getKey(), message.getValue()), (recordMetadata, e) -> {
        if (e != null) {
          log.error("Failed to send message to topic {} due to exception: ", topic, e);
        }
      });
    }
  }
1341194
public void publishInternal(Object message) {
        topicStats.incrementPublishes();
        topicService.publishMessage(name, message, multithreaded);
    }
774950
public void pushMessages(List<Pair<K, V>> messages) {
    for (Pair<K, V> message: messages) {
      this.futures.offer(this.producer.send(new ProducerRecord<>(topic, message.getKey(), message.getValue()), (recordMetadata, e) -> {
        if (e != null) {
          log.error("Failed to send message to topic {} due to exception: ", topic, e);
        }
      }));
    }

    //Once the low watermark of numFuturesToBuffer is hit, start flushing messages from the futures
    // buffer. In order to avoid blocking on newest messages added to futures queue, we only invoke future.get() on
    // the oldest messages in the futures buffer. The number of messages to flush is same as the number of messages added
    // in the current call. Note this does not completely avoid calling future.get() on the newer messages e.g. when
    // multiple threads enter the if{} block concurrently, and invoke flush().
    if (this.futures.size() >= this.numFuturesToBuffer) {
      flush(messages.size());
    }
  }