Send all queued messages

@param Certificate|null When given only the gateway connection for the given certificate is flushed
191682
public function flush(Certificate $certificate = null)
	{
		// Check if we must flush a specific gateway
		if (null == $certificate)
		{
			// No, flush the whole gateway pool
			foreach ($this->gatewayPool as $gateway)
			{
				$gateway->flush();
			}
		}
		else
		{
			// Yes, flush only the requested gateway
			$this->getGatewayForCertificate($certificate)->flush();
		}
	}
474344
public void sendAll(String apiKey, Map<String, ? extends Collection<?>> messagesByQueue) {
        checkNotNull(messagesByQueue, "messagesByQueue");
        if (messagesByQueue.isEmpty()) {
            return;
        }
        if (messagesByQueue.size() == 1) {
            // Prefer the single queue REST call because it'll log the queue name in the HTTP server request logs.
            Map.Entry<String, ? extends Collection<?>> entry = Iterables.getOnlyElement(messagesByQueue.entrySet());
            sendAll(apiKey, entry.getKey(), entry.getValue());
            return;
        }
        try {
            URI uri = _queueService.clone()
                    .segment("_sendbatch")
                    .build();
            _client.resource(uri)
                    .type(MediaType.APPLICATION_JSON_TYPE)
                    .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
                    .post(messagesByQueue);
        } catch (EmoClientException e) {
            throw convertException(e);
        }
    }
943413
public void sendOneWay(MessageOut message, int id, InetAddress to)
    {
        if (logger.isTraceEnabled())
            logger.trace(FBUtilities.getBroadcastAddress() + " sending " + message.verb + " to " + id + "@" + to);

        if (to.equals(FBUtilities.getBroadcastAddress()))
            logger.trace("Message-to-self {} going over MessagingService", message);

        // message sinks are a testing hook
        MessageOut processedMessage = SinkManager.processOutboundMessage(message, id, to);
        if (processedMessage == null)
        {
            return;
        }

        // get pooled connection (really, connection queue)
        OutboundTcpConnection connection = getConnection(to, processedMessage);

        // write it
        connection.enqueue(processedMessage, id);
    }
607123
public void queue(JFapByteBuffer bufferData,
                     int segmentType,
                     int requestNumber,
                     int priority,
                     SendListener sendListener,
                     Conversation conversation,
                     Connection connection,
                     int conversationId,
                     boolean pooledBuffers,
                     boolean partOfExchange,
                     long size,
                     boolean terminal,
                     ThrottlingPolicy throttlingPolicy)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "queue");
      TransmissionDataIterator iterator =
         TransmissionDataIterator.allocateFromPool(connection,
                                                   bufferData,
                                                   priority,
                                                   pooledBuffers,
                                                   partOfExchange,
                                                   segmentType,
                                                   conversationId,
                                                   requestNumber,
                                                   conversation,
                                                   sendListener,
                                                   terminal,
                                                   (int)size);

      // begin F193735.3
      if (type == Conversation.ME)           meQueuedBytes += size;
      else if (type == Conversation.CLIENT)  clientQueuedBytes += size;
      // end F193735.3

      queueInternal(iterator, throttlingPolicy, terminal);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "queue");
   }
240760
public void sendStart(boolean restart) throws SIConnectionDroppedException, SIConnectionLostException        //471642
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendStart","restart="+restart);
      if (sessionId == 0)
      {
         // If the session Id = 0, then no one called setSessionId(). As such we are unable to flow
         // to the server as we do not know which session to instruct the server to use.
         SIErrorException e = new SIErrorException(
            nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null)
         );

         FFDCFilter.processException(e, CLASS_NAME + ".sendStart",
                                     CommsConstants.CONVERSATIONHELPERIMPL_03, this);

         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);

         throw e;
      }

      CommsByteBuffer request = getCommsByteBuffer();
      // Connection object id
      request.putShort((short) connectionObjectId);
      // Consumer session id
      request.putShort(sessionId);

      final HandshakeProperties handshakeProps = conversation.getHandshakeProperties();
      final short fapVersion = handshakeProps.getFapLevel();

      // If a restart was requested and the conversation FAP version is >= 9 then send a restart segmentId so that
      // the other end knows that it should check the consumer session state is not stopped before processing the
      // request. When a stoppable async consumer callback is in use it is possible for message processor to stop
      // the consumer session in the server but for the notification not to reach the client until after the client
      // has requested the next batch of messages. By using a restart segmentId the client can tell the comms server
      // end to check the session state before processing the request. If it turns out that message processor has
      // stopped the consumer session then the start request is ignored.
      jfapSend(request,                                                                                         //471642
               (restart && fapVersion >= JFapChannelConstants.FAP_VERSION_9) ? JFapChannelConstants.SEG_RESTART_SESS : JFapChannelConstants.SEG_START_SESS,
               JFapChannelConstants.PRIORITY_MEDIUM,
               true,
               ThrottlingPolicy.BLOCK_THREAD);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendStart");
   }
675212
public void sendToAllTCP (Object object) {
		Connection[] connections = this.connections;
		for (int i = 0, n = connections.length; i < n; i++) {
			Connection connection = connections[i];
			connection.sendTCP(object);
		}
	}
459858
public void setCertificates(java.util.Collection<CACertificate> certificates) {
        if (certificates == null) {
            this.certificates = null;
            return;
        }

        this.certificates = new java.util.ArrayList<CACertificate>(certificates);
    }
563245
public void sendMessage(final String message) {
		if(userSession == null) {
			logger.error("Unable to send message, user session is null");
			return;
		}
		if(userSession.getAsyncRemote() == null) {
			logger.error("Unable to send message, async remote is null");
			return;
		}
		userSession.getAsyncRemote().sendText(message);
	}
793996
public static String pingJmsBackoutQueue(MuleContext muleContext, String muleJmsConnectorName, String queueName) {
	    try {
	    	if (isQueueEmpty(muleContext, muleJmsConnectorName, queueName)) {
	    	    return OK_PREFIX + ": The queue " + queueName + " in the queue manager " + muleJmsConnectorName + " is empty"; 
	    		
	    	} else {
	    	    return ERROR_PREFIX + ": The queue " + queueName + " in the queue manager " + muleJmsConnectorName + " is not empty"; 
	    	}
	
	    } catch (JMSException e) {
		    return ERROR_PREFIX + ": The queue " + queueName + " was not found in the queue manager " + muleJmsConnectorName + ", reason: " + e.getMessage(); 
	    }	
	}
1306171
public byte[] sendWithResult(final byte[] message) {
        synchronized (webSocketHandler.getNotifyResultObject()) {
            webSocketHandler.sendMessage(message);

            try {
                webSocketHandler.getNotifyResultObject().wait(TimeUnit.SECONDS.toMillis(ANSWER_TIMEOUT));
            }
            catch (InterruptedException e) {
                return null;
            }

            return webSocketHandler.getResultBytes();
        }
    }
624829
public void sendMessage(Message message)
    {
        try   {
            if (((RemoteMessageQueue)this.getMessageQueue()).isSendRemoteMessage((BaseMessage)message) == false)
                return;
            if (((BaseMessage)message).isProcessedByServer())
                return;     // Don't send back down (the server already processed it).
            if (((BaseMessage)message).isConsumed())
                return;     // Don't send if already handled.
            if (MessageConstants.LOCAL_QUEUE.equalsIgnoreCase(((BaseMessage)message).getMessageHeader().getQueueType()))
                return;     // Local queue only
            synchronized (m_sendQueue)
            {   // In case this is called from another task
                m_sendQueue.sendMessage(message);
            }
        } catch (RemoteException ex)    {
            ex.printStackTrace();
        }
    }
745568
@Override
	public void send(AbstractPacket packet) throws PacketTransportException
	{
		if (closed)
			throw new PacketTransportException("Transport is closed");
	
		if (packet.isResponseExpected())
			lastSendActivity = System.currentTimeMillis();
		
		boolean wakeUpRequired;
		synchronized (sendQueue)
		{
			wakeUpRequired = sendQueue.isEmpty();
			sendQueue.add(packet);
		}
		
		if (wakeUpRequired)
			multiplexer.wakeUp();
	}
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);
    }
880222
def send_to_queue(self, message):
        
        if not self.queue_delivery:
            raise RuntimeError("No queue_path provided")

        return self.queue_delivery.send(*self._message_args(message))
33319
public void send(CEMILData msg, boolean waitForCon) throws KNXTimeoutException,
		KNXLinkClosedException
	{
		doSend(adjustMsgType(msg), waitForCon);
	}
470059
function sendIpc(message) {
    var requestIds;
    clearTimeout(retryTimer);
    if (message) { tranRequests[message._requestId] = message; }
    if ((requestIds = Object.keys(tranRequests)).length) {
      if (!childProc) { throw new Error('Child process already exited.'); }
      requestIds.forEach(function(requestId) {
        console.info('Try to send IPC message: %d', +requestId);
        childProc.send(tranRequests[requestId]);
      });
      retryTimer = setTimeout(errorHandle(sendIpc), IPC_RETRY_INTERVAL);
    }
  }
267107
public void send(String apiKey, String queue, final Object message) {
        checkNotNull(queue, "queue");
        try {
            URI uri = _queueService.clone()
                    .segment(queue, "send")
                    .build();
            _client.resource(uri)
                    .type(MediaType.APPLICATION_JSON_TYPE)
                    .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
                    // Wrap the message in a JSONWrappedObject that forces Jersey to use Jackson to serialize it
                    // no matter what the type.  Otherwise null and String objects don't get serialized correctly.
                    .post(new JSONWrappedObject("", "", message));
        } catch (EmoClientException e) {
            throw convertException(e);
        }
    }