Push an ndarray message to the specified
ndarray send url in the form of:
host;port:stream
where stream is the stream for connecting
to a listening aeron server
@param message the array to send
974218
public void pushNDArrayMessage(NDArrayMessage message) {
        //start a subscriber that can send us ndarrays
        if (subscriber == null) {
            running = new AtomicBoolean(true);
            subscriber = AeronNDArraySubscriber.startSubscriber(aeron, subscriberHost, subscriberPort, this,
                            subscriberStream, running);
            log.debug("Started parameter server client on " + subscriber.connectionUrl());
        }

        String[] split = ndarraySendUrl.split(":");
        int port = Integer.parseInt(split[1]);
        int streamToPublish = Integer.parseInt(split[2]);
        String channel = AeronUtil.aeronChannel(split[0], port);
        log.debug("Parameter server client publishing to " + ndarraySendUrl);
        try (AeronNDArrayPublisher publisher = AeronNDArrayPublisher.builder().streamId(streamToPublish)
                        .compress(isCompressArray()).aeron(aeron).channel(channel).build()) {
            publisher.publish(message);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
99437
public static DirectBuffer toBuffer(NDArrayMessage message) {
        ByteBuffer byteBuffer =
                        ByteBuffer.allocateDirect(byteBufferSizeForMessage(message)).order(ByteOrder.nativeOrder());
        //declare message opType
        byteBuffer.putInt(MessageType.WHOLE.ordinal());
        //perform the ndarray put on the
        if (message.getArr().isCompressed()) {
            AeronNDArraySerde.doByteBufferPutCompressed(message.getArr(), byteBuffer, false);
        } else {
            AeronNDArraySerde.doByteBufferPutUnCompressed(message.getArr(), byteBuffer, false);
        }

        long sent = message.getSent();
        long index = message.getIndex();

        byteBuffer.putLong(sent);
        byteBuffer.putLong(index);
        byteBuffer.putInt(message.getDimensions().length);
        for (int i = 0; i < message.getDimensions().length; i++) {
            byteBuffer.putInt(message.getDimensions()[i]);
        }

        //rewind the buffer before putting it in to the unsafe buffer
        //note that we set rewind to false in the do byte buffer put methods
        byteBuffer.rewind();

        return new UnsafeBuffer(byteBuffer);
    }
1222318
def send_message(self, destination_id, namespace, data,
                     inc_session_id=False, callback_function=False,
                     no_add_request_id=False, force=False):
        

        # namespace is a string containing namespace
        # data is a dict that will be converted to json
        # wait_for_response only works if we have a request id

        # If channel is not open yet, connect to it.
        self._ensure_channel_connected(destination_id)

        request_id = None
        if not no_add_request_id:
            request_id = self._gen_request_id()
            data[REQUEST_ID] = request_id

        if inc_session_id:
            data[SESSION_ID] = self.session_id

        # pylint: disable=no-member
        msg = cast_channel_pb2.CastMessage()

        msg.protocol_version = msg.CASTV2_1_0
        msg.source_id = self.source_id
        msg.destination_id = destination_id
        msg.payload_type = cast_channel_pb2.CastMessage.STRING
        msg.namespace = namespace
        msg.payload_utf8 = _json_to_payload(data)

        # prepend message with Big-Endian 4 byte payload size
        be_size = pack(">I", msg.ByteSize())

        # Log all messages except heartbeat
        if msg.namespace != NS_HEARTBEAT:
            self.logger.debug("[%s:%s] Sending: %s",
                              self.fn or self.host, self.port,
                              _message_to_string(msg, data))

        if not force and self.stop.is_set():
            raise PyChromecastStopped("Socket client's thread is stopped.")
        if not self.connecting and not self._force_recon:
            try:
                if not no_add_request_id and callback_function:
                    self._request_callbacks[request_id] = {
                        'event': threading.Event(),
                        'response': None,
                        'function': callback_function,
                    }
                self.socket.sendall(be_size + msg.SerializeToString())
            except socket.error:
                self._request_callbacks.pop(request_id, None)
                self._force_recon = True
                self.logger.info('[%s:%s] Error writing to socket.',
                                 self.fn or self.host, self.port)
        else:
            raise NotConnected("Chromecast " + self.host + ":" +
                               str(self.port) + " is connecting...")
854116
protected final void putMessage(Http2Stream stream, FullHttpMessage message) {
        FullHttpMessage previous = stream.setProperty(messageKey, message);
        if (previous != message && previous != null) {
            previous.release();
        }
    }
1326886
public static void pushMessages(String queueURL, List<String> messages) {
		if (!StringUtils.isBlank(queueURL) && messages != null) {
			// only allow strings - ie JSON
			try {
				int	j = 0;
				List<SendMessageBatchRequestEntry> msgs = new ArrayList<>(MAX_MESSAGES);
				for (int i = 0; i < messages.size(); i++) {
					String message = messages.get(i);
					if (!StringUtils.isBlank(message)) {
						msgs.add(new SendMessageBatchRequestEntry().
								withMessageBody(message).
								withId(Integer.toString(i)));
					}
					if (++j >= MAX_MESSAGES || i == messages.size() - 1) {
						if (!msgs.isEmpty()) {
							getClient().sendMessageBatch(queueURL, msgs);
							msgs.clear();
						}
						j = 0;
					}
				}
			} catch (AmazonServiceException ase) {
				logException(ase);
			} catch (AmazonClientException ace) {
				logger.error("Could not reach SQS. {}", ace.toString());
			}
		}
	}
923596
def broadcast(message):
    
    try:
        socket = CLIENTS.values()[0][1]
    except IndexError:
        raise NoSocket("There are no clients.")
    socket.send_and_broadcast(message)
196804
public void sendMessage(Message message) throws NotConnectedException, InterruptedException {
        message.setTo(room);
        message.setType(Message.Type.groupchat);
        connection.sendStanza(message);
    }
673257
def send_message(self, msg_dict):
        """"""
        with self._writer_lock:
            try:
                self.output_stream.flush()
                self.output_stream.write(self.serialize_dict(msg_dict))
                self.output_stream.flush()
            except IOError:
                raise StormWentAwayError()
            except:
                log.exception("Failed to send message: %r", msg_dict)
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);
        }
    }
788668
@Override
    public void onNDArrayMessage(NDArrayMessage message) {
        INDArray arr = message.getArr();
        //of note for ndarrays
        int[] dimensions = message.getDimensions();
        boolean whole = dimensions.length == 1 && dimensions[0] == -1;

        if (!whole)
            onNDArrayPartial(arr, message.getIndex(), dimensions);
        else
            onNDArray(arr);
    }
990327
function Channel_sendMessage(message) {
  if (!this.wsConn) return
  if (!this.wsConn.connected) return

  DEBUGMSG("send: " + utils.JS(message))

  try {
    this.wsConn.sendUTF(JSON.stringify(message))
  }
  catch(e) {
    // occurs when socket closed, oh well
  }
}
1135105
public void send(Message message)
  {
    Transport smtp = null;

    try {
      smtp = _session.getTransport("smtp");

      smtp.connect();

      smtp.send(message, _to);

      log.fine(this + " sent mail to " + _to[0]);
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw new RuntimeException(e);
    } finally {
      try {
        if (smtp != null)
          smtp.close();
      } catch (Exception e) {
        log.log(Level.FINER, e.toString(), e);
      }
    }
  }
348221
protected void sendMessageToInstance(int taskId, HeronTuples.HeronTupleSet message) {
    taskIdToInstanceExecutor.get(taskId).getStreamInQueue().offer(message);
  }
953409
private void sendOrPublishMessage(Message message) {
        if (endpointConfiguration.isPubSubDomain()) {
            if (log.isDebugEnabled()) {
                log.debug("Publish Vert.x event bus message to address: '" + endpointConfiguration.getAddress() + "'");
            }
            vertx.eventBus().publish(endpointConfiguration.getAddress(), message.getPayload());
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Sending Vert.x event bus message to address: '" + endpointConfiguration.getAddress() + "'");
            }
            vertx.eventBus().send(endpointConfiguration.getAddress(), message.getPayload());
        }
    }
29028
private void sendMessage(NetworkMessage message)
    {
        try (ByteArrayOutputStream encode = message.encode())
        {
            final byte[] encoded = encode.toByteArray();
            // Message header
            out.writeByte(NetworkMessageSystemId.USER_MESSAGE);
            out.writeByte(message.getClientId());
            out.writeByte(message.getClientDestId());
            out.writeByte(message.getType());
            // Message content
            out.writeInt(encoded.length);
            out.write(encoded);
            out.flush();

            final int headerSize = 8;
            bandwidth += headerSize + encoded.length;
        }
        catch (final IOException exception)
        {
            Verbose.exception(exception, "Unable to send the message for client: ", String.valueOf(clientId));
        }
    }
1215594
protected synchronized void sendCommandToShard(VoidMessage message) {
        // if this node is shard - we just step over TCP/IP infrastructure
        // TODO: we want LocalTransport to be used in such cases
        if (nodeRole == NodeRole.SHARD) {
            message.setTargetId(shardIndex);
            messages.add(message);
            return;
        }


        //log.info("Sending CS: {}", message.getClass().getCanonicalName());

        message.setTargetId(targetIndex);
        DirectBuffer buffer = message.asUnsafeBuffer();

        long result = publicationForShards.offer(buffer);

        if (result < 0)
            for (int i = 0; i < 5 && result < 0; i++) {
                try {
                    // TODO: make this configurable
                    Thread.sleep(1000);
                } catch (Exception e) {
                }
                result = publicationForShards.offer(buffer);
            }

        // TODO: handle retransmit & backpressure separately

        if (result < 0)
            throw new RuntimeException("Unable to send message over the wire. Error code: " + result);
    }
816829
public void sendNotFlushedMessage(SIBUuid8 ignore, SIBUuid12 streamID, long requestID) 
  throws SIResourceException 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "sendNotFlushedMessage", 
        new Object[]{ignore, streamID, new Long(requestID)});

    ControlNotFlushed notFlushed = createControlNotFlushed(streamID, requestID);
    notFlushed = sourceStreamManager.stampNotFlushed(notFlushed);
    
    // If the destination in a Link add Link specific properties to message
    if( isLink )
    {
      notFlushed = (ControlNotFlushed)addLinkProps(notFlushed);
      // The following is set so we can create the linkReceiver correctly on the 
      // other side of the link - 499581
      notFlushed.setRoutingDestination(routingDestination);
    }
    else if( this.isSystemOrTemp )
    {
      // If the destination is system or temporary then  the 
      // routingDestination into th message
      notFlushed.setRoutingDestination(routingDestination); 
    }
    
 
    mpio.sendToMe(routingMEUuid, SIMPConstants.MSG_HIGH_PRIORITY, notFlushed);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendNotFlushedMessage");
  }