Consumes a tuple and sends a JMS message.
<p/>
If autoAck is true, the tuple will be acknowledged
after the message is sent.
<p/>
If JMS sending fails, the tuple will be failed.
197563
@Override
	public void execute(Tuple input) {
		// write the tuple to a JMS destination...
		LOG.debug("Tuple received. Sending JMS message.");
		
		try {
			Message msg = this.producer.toMessage(this.session, input);
			if(msg != null){
				if (msg.getJMSDestination() != null) {
					this.messageProducer.send(msg.getJMSDestination(), msg);
				} else {
					this.messageProducer.send(msg);
				}
			}
			if(this.autoAck){
				LOG.debug("ACKing tuple: " + input);
				this.collector.ack(input);
			}		
		} catch (JMSException e) {
			// failed to send the JMS message, fail the tuple fast
			LOG.warn("Failing tuple: " + input);
			LOG.warn("Exception: ", e);
			this.collector.fail(input);
		}
	}
394260
@Override
    public void sendAckMessage(
                               SIBUuid8 upstream,
                               SIBUuid12 destUuid,
                               SIBUuid8 busUuid,
                               long ackPrefix,
                               int priority,
                               Reliability reliability,
                               SIBUuid12 stream,
                               boolean consolidate) throws SIResourceException, SIErrorException
    {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "sendAckMessage", new Long(ackPrefix));

        if (upstream == null)
        {
            upstream = _originStreamMap.get(stream);
        }

        ControlAck ackMsg = createControlAckMessage(priority, reliability, stream);

        ackMsg.setAckPrefix(ackPrefix);

        if ((consolidate) &&
            (_internalInputStreamManager.hasStream(stream, priority, reliability)))
        {
            try
            {
                processAck(ackMsg);
            } catch (SIResourceException e)
            {
                // FFDC
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.PubSubInputHandler.sendAckMessage",
                                            "1:600:1.329.1.1",
                                            this);
            }
        }
        else
        {
            // Send this to MPIO
            // Send Ack messages at the priority of the original message +1
            _mpio.sendToMe(
                           upstream,
                           priority + 1,
                           ackMsg);

        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "sendAckMessage");
    }
666534
@Override
	public final void send(Message message) throws JMSException
    {
    	if (this.destination == null)
    		throw new UnsupportedOperationException("Destination was not set at creation time");
    	
    	// Setup message fields
    	setupMessage(destination,message,defaultDeliveryMode,defaultPriority,defaultTimeToLive);
    	
    	// Handle foreign message implementations
        message = MessageTools.normalize(message);

        sendToDestination(destination,false,message,defaultDeliveryMode,defaultPriority,defaultTimeToLive);
    }
119007
private void send(T value)
  {
    for (SubscriberNode sub : _subscribers) {
      sub.next(value);
    }
    
    long seq = _sequence++;
    int size = _consumers.size();
    
    if (size > 0) {
      int index = (int) (seq % size);
      
      _consumers.get(index).next(value);
    }
  }
882369
@SuppressWarnings("unchecked")
	public SipServletRequest createAck() {
		final Response response = getResponse();
		if(logger.isDebugEnabled()) {
			logger.debug("transaction " + getTransaction());
			logger.debug("originalRequest " + originalRequest);
		}
		// transaction can be null in case of forking
		if(((getTransaction() == null && originalRequest != null && !Request.INVITE.equals(getMethod()) && !Request.INVITE.equals(originalRequest.getMethod()))) || 
				(getTransaction() != null && !Request.INVITE.equals(((SIPTransaction)getTransaction()).getMethod())) || 
				(response.getStatusCode() >= 100 && response.getStatusCode() < 200) || 
				isAckGenerated) {
			if(logger.isDebugEnabled()) {
				logger.debug("transaction state " + ((SIPTransaction)getTransaction()).getMethod() + " status code " + response.getStatusCode() + " isAckGenerated " + isAckGenerated);
			}
			throw new IllegalStateException("the transaction state is such that it doesn't allow an ACK to be sent now, e.g. the original request was not an INVITE, or this response is provisional only, or an ACK has already been generated");
		}
		final MobicentsSipSession session = getSipSession();
		Dialog dialog = session.getSessionCreatingDialog();
		CSeqHeader cSeqHeader = (CSeqHeader)response.getHeader(CSeqHeader.NAME);
		SipServletRequestImpl sipServletAckRequest = null; 
		try {
			if(logger.isDebugEnabled()) {
				logger.debug("dialog to create the ack Request " + dialog);
			}
			Request ackRequest = dialog.createAck(cSeqHeader.getSeqNumber());
			// Workaround wrong UA stack for Issue 1802 
			ackRequest.removeHeader(ViaHeader.NAME);
			if(logger.isInfoEnabled()) {
				logger.info("ackRequest just created " + ackRequest);
			}
			//Application Routing to avoid going through the same app that created the ack
			ListIterator<RouteHeader> routeHeaders = ackRequest.getHeaders(RouteHeader.NAME);
			ackRequest.removeHeader(RouteHeader.NAME);
			while (routeHeaders.hasNext()) {
				RouteHeader routeHeader = routeHeaders.next();
				String serverId = ((SipURI)routeHeader .getAddress().getURI()).
						getParameter(MessageDispatcher.RR_PARAM_SERVER_NAME);
				String routeAppNameHashed = ((SipURI)routeHeader .getAddress().getURI()).
					getParameter(MessageDispatcher.RR_PARAM_APPLICATION_NAME);
				String routeAppName = null;
				if(routeAppNameHashed != null) {
					routeAppName = sipFactoryImpl.getSipApplicationDispatcher().getApplicationNameFromHash(routeAppNameHashed);
				}
				if(routeAppName == null || !sipFactoryImpl.getSipApplicationDispatcher().getApplicationServerId().equalsIgnoreCase(serverId) || !routeAppName.equals(getSipSession().getKey().getApplicationName())) {
					ackRequest.addHeader(routeHeader);
				}
			}
			sipServletAckRequest = (SipServletRequestImpl) sipFactoryImpl.getMobicentsSipServletMessageFactory().createSipServletRequest(
					ackRequest,
					this.getSipSession(), 
					this.getTransaction(), 
					dialog, 
					false); 
			isAckGenerated = true;
		} catch (InvalidArgumentException e) {
			logger.error("Impossible to create the ACK",e);
		} catch (SipException e) {
			logger.error("Impossible to create the ACK",e);
		}		
		return sipServletAckRequest;
	}
438056
@Override
	public boolean putLocked( AbstractMessage srcMessage, LocalSession session , MessageLockSet locks ) throws JMSException
    {
    	checkNotClosed();
    	checkTransactionLock();
    
    	// Check delivery mode
    	if (!topicDef.supportDeliveryMode(srcMessage.getJMSDeliveryMode()))
    		throw new FFMQException("Topic does not support this delivery mode : "+
    				(srcMessage.getJMSDeliveryMode() == DeliveryMode.NON_PERSISTENT ? 
                    "DeliveryMode.NON_PERSISTENT" : "DeliveryMode.PERSISTENT"),
                    "INVALID_DELIVERY_MODE");
    	
    	sentToTopicCount.incrementAndGet();
    	
        boolean commitRequired = false;
        
        subscriptionsLock.readLock().lock();
        try
        {
        	// Pass 1 - Indexed subscriptions
        	if (!indexedSubscriptionMap.isEmpty())
        	{
        		srcMessage.ensureDeserializationLevel(MessageSerializationLevel.ALL_HEADERS);
        		for(Entry<String,Map<Object,List<LocalTopicSubscription>>> entry : indexedSubscriptionMap.entrySet())
        		{
        			String headerName = entry.getKey();
        			Object value;
        			if (headerName.equals("JMSCorrelationID")) // Intercept special headers
        				value = srcMessage.getJMSCorrelationID();
        			else
        				value = srcMessage.getObjectProperty(headerName);
        			
        			if (value != null)
        			{
        				value = normalizeLiteralValue(value);
        				List<LocalTopicSubscription> subscriptions = entry.getValue().get(value);
        				if (subscriptions != null)
        				{
        					if (pushToSubscriptions(srcMessage, session, locks, subscriptions))
        						commitRequired = true;
        				}
        			}
        		}
        	}
        	
        	// Pass 2 - Non indexed subscriptions
            if (!flatSubscriptions.isEmpty())
            	if (pushToSubscriptions(srcMessage, session, locks, flatSubscriptions))
            		commitRequired = true;
        }
        finally
        {
        	subscriptionsLock.readLock().unlock();
        }
        
        return commitRequired;
    }
1310845
@Override
  @SuppressWarnings("checkstyle:diamondoperatorforvariabledefinition")
  public synchronized void onNext(final RemoteEvent<byte[]> value) {

    LOG.log(Level.FINER, "RemoteManager: {0} value: {1}", new Object[] {this.name, value});

    final T decodedEvent = this.codec.decode(value.getEvent());
    final Class<? extends T> clazz = (Class<? extends T>) decodedEvent.getClass();

    LOG.log(Level.FINEST, "RemoteManager: {0} decoded event {1} :: {2}",
        new Object[] {this.name, clazz.getCanonicalName(), decodedEvent});

    // check remote identifier and message type
    final SocketRemoteIdentifier id = new SocketRemoteIdentifier((InetSocketAddress)value.remoteAddress());

    final Tuple2<RemoteIdentifier, Class<? extends T>> tuple =
        new Tuple2<RemoteIdentifier, Class<? extends T>>(id, clazz);

    final EventHandler<? super T> tupleHandler = this.tupleToHandlerMap.get(tuple);

    if (tupleHandler != null) {

      LOG.log(Level.FINER, "Tuple handler: {0},{1}",
          new Object[] {tuple.getT1(), tuple.getT2().getCanonicalName()});

      tupleHandler.onNext(decodedEvent);

    } else {

      final EventHandler<RemoteMessage<? extends T>> messageHandler = this.msgTypeToHandlerMap.get(clazz);

      if (messageHandler == null) {
        final RuntimeException ex = new RemoteRuntimeException(
            "Unknown message type in dispatch: " + clazz.getCanonicalName() + " from " + id);
        LOG.log(Level.WARNING, "Unknown message type in dispatch.", ex);
        throw ex;
      }

      LOG.log(Level.FINER, "Message handler: {0}", clazz.getCanonicalName());

      messageHandler.onNext(new DefaultRemoteMessage<>(id, decodedEvent));
    }
  }
495660
private void sendUsingProducerSession(Message message) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "sendUsingProducerSession", new Object[] { message });

        checkClosed();
        // check for sync/async conflicts
        session.checkSynchronousUsage("send");
        // if the supplied message is null, throw a jms MessageFormatException.
        if (message == null) {
            throw (MessageFormatException) JmsErrorUtils.newThrowable(
                                                                      MessageFormatException.class,
                                                                      "INVALID_VALUE_CWSIA0068",
                                                                      new Object[] { "message", null },
                                                                      tc);
        }
        if (propsOverriden) {
            // This block will be invoked if the user is flipping back and forth
            // between the multi-arg identified send, and this 1-arg send. In this
            // case we need to re-instate the dm, pri, ttl values from the producer.
            producerProperties.setInDeliveryMode(defaultDeliveryMode);
            producerProperties.setInPriority(defaultPriority);
            producerProperties.setInTTL(defaultTimeToLive);

            // Mark that we are back with the defaults so we don't do this set the
            // next time around.
            propsOverriden = false;
        }

        // Delegate to the internal send method.
        sendMessage(producerProperties, message, dest);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "sendUsingProducerSession");

    }
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);
    }
1024794
public final CompletableFuture<Integer> send(Object message, boolean last) {
        return send(false, message, last);
    }
1234166
@ObjectiveCName("sendMessageWithPeer:withText:withMarkdownText:withMentions:autoDetect:")
    public void sendMessage(@NotNull Peer peer, @NotNull String text, @Nullable String markDownText,
                            @Nullable ArrayList<Integer> mentions, boolean autoDetect) {
        modules.getMessagesModule().sendMessage(peer, text, markDownText, mentions, autoDetect);
    }
1209315
@SuppressWarnings("checkstyle:illegalcatch")
  private void deliverMessageToTask(final byte[] message) throws TaskMessageHandlerFailure {
    try {
      this.fMessageHandler.get().onNext(new DriverMessageImpl(message));
    } catch (final Throwable throwable) {
      throw new TaskMessageHandlerFailure(throwable);
    }
  }
546530
@Override
    public final void execute(Tuple tuple, BasicOutputCollector collector) {
        if (TupleUtils.isTick(tuple)) {
            getLogger().debug("Received tick tuple, triggering emit of current rankings");
            emitRankings(collector);
        } else {
            updateRankingsWithTuple(tuple);
        }
    }
1051313
public void sendAck(Request arg0) throws SipException {
		if (tracer.isInfoEnabled()) {
			tracer.info(this+" sending ACK:\n"+arg0);
		}
		wrappedDialog.sendAck(arg0);
	}
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();
        }
    }
1234338
public void sendMessage(Message message)
    {
        if (message == null)
            return;     // Don't allow a null message to be sent.
        m_stack.add(message);
        if (m_bWaiting)
        {
            synchronized (m_thread)
            {
                if (m_bWaiting) // Inside the sync block
                    m_thread.notify();
            }
        }
    }
961733
public void sendMessage(String message){

		byte[] datagramData = message.getBytes();
		datagramPacket.setData(datagramData);

		try {
			datagramSocket.send(datagramPacket);
		} catch (IOException e) {
			Log.e(TAG, "Failed to send datagram log " + e);
		}
	}