Send a single event to the collector

@param eventPayload Event to sent, created by the EventBuilder
@return true on success (collector got the event), false otherwise (event was lost)
541089
public Future<Boolean> send(final String eventPayload)
    {
        if (client == null || client.isClosed()) {
            client = new AsyncHttpClient(clientConfig);
        }

        try {
            final AsyncHttpClient.BoundRequestBuilder requestBuilder = client
                .prepareGet(collectorURI + eventPayload);
            log.debug("Sending event to collector: {}", eventPayload);

            activeRequests.incrementAndGet();
            return client.executeRequest(requestBuilder.build(),
                new AsyncCompletionHandler<Boolean>()
                {
                    @Override
                    public Boolean onCompleted(final Response response)
                    {
                        activeRequests.decrementAndGet();

                        if (response.getStatusCode() == 202) {
                            return true;
                        }
                        else {
                            log.warn("Received response from collector {}: {}", response.getStatusCode(), response.getStatusText());
                            return false;
                        }
                    }

                    @Override
                    public void onThrowable(final Throwable t)
                    {
                        activeRequests.decrementAndGet();
                    }
                });
        }
        catch (IOException e) {
            // Recycle the client
            client.close();
            return null;
        }
    }
864104
public synchronized void send(String data, String event, String id, EventCallback callback) {
        if (open == 0 || shutdown) {
            if (callback != null) {
                callback.failed(this, data, event, id, new ClosedChannelException());
            }
            return;
        }
        queue.add(new SSEData(event, data, id, callback));
        sink.getIoThread().execute(new Runnable() {
            @Override
            public void run() {
                synchronized (ServerSentEventConnection.this) {
                    if (pooled == null) {
                        fillBuffer();
                        writeListener.handleEvent(sink);
                    }
                }
            }
        });
    }
1166403
private void publishEvent(WSJobExecution objectToPublish, String eventToPublishTo) {
        if (getBatchEventsPublisher() != null) {
            getBatchEventsPublisher().publishJobExecutionEvent(objectToPublish, eventToPublishTo, correlationId);
        }
    }
776700
public function send($rawPayload)
        {
            return $this->transport->post($this->getEndpoint(),[],$this->serializePayload($rawPayload));
        }
872766
private void send(JainMgcpResponseEvent event) {

		cancelLongtranTimer();

		// to send response we already should know the address and port
		// number from which the original request was received
		if (remoteAddress == null) {
			throw new IllegalArgumentException("Unknown orinator address");
		}

		// restore the original transaction handle parameter
		// and encode event objet into MGCP response message
		event.setTransactionHandle(remoteTID);

		// encode event object into MGCP response message
		if(originalPacket==null)
			originalPacket=stack.allocatePacket();
		
		originalPacket.setLength(encode(event,originalPacket.getRawData()));						
		InetSocketAddress inetSocketAddress = new InetSocketAddress(remoteAddress, remotePort);
		originalPacket.setRemoteAddress(inetSocketAddress);		
		
		if (logger.isDebugEnabled()) {
			logger.debug("--- TransactionHandler:" + this + " :LocalID=" + localTID + ", Send response event to "
					+ remoteAddress + ":" + remotePort + ", message\n" + new String(originalPacket.getRawData(),0,originalPacket.getLength()));
		}
		stack.send(originalPacket);

		/*
		 * Just reset timer in case of provisional response. Otherwise, release tx.
		 */
		if (isProvisional(event.getReturnCode())) {
			// reset timer.
			resetLongtranTimer();
		} else {
			
			release();
			stack.getCompletedTransactions().put(Integer.valueOf(event.getTransactionHandle()), this);
			resetTHISTTimerTask(true);
		}
	}
1037660
private boolean isSendEvent() throws DevFailed {
        boolean send = false;
        if ((eventTrigger.doCheck() && eventTrigger.isSendEvent()) || !eventTrigger.doCheck()) {
            send = true;
        }
        return send;
    }
412138
public function sendEvent(Event $event)
    {
        try {
            $this->eventFactory->addDefaultTagsToEntity($event);
            $this->sendEventThroughSenders($event);
        } catch (\Exception $exception) {
            $this->logException($exception);
        }
    }
241348
@Override
	void sendTaskEvent(TaskEvent event) throws IOException {
		checkError();
		checkState(subpartitionView != null, "Tried to send task event to producer before requesting the subpartition.");

		if (!taskEventPublisher.publish(partitionId, event)) {
			throw new IOException("Error while publishing event " + event + " to producer. The producer could not be found.");
		}
	}
751690
public function sendPerformed(Swift_Events_SendEvent $evt)
    {
        $message = $evt->getMessage();

        // restore original headers
        $id = $message->getId();
        if (array_key_exists($id, $this->handledMessageIds)) {
            $message->setFrom(null);
            unset($this->handledMessageIds[$id]);
        }
    }
101151
public void sendEvent(final Map<String, String> params) {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                // put user id
                params.put("cid", userId);
                Multimap queryParams = HashMultimap.create();
                for (Map.Entry<String, String> entry : params.entrySet()) {
                    String key = entry.getKey();
                    String value = entry.getValue();
                    Preconditions.checkNotNull(key, "Custom search param key must not be null.");
                    Preconditions.checkNotNull(value, "Custom search param value must not be null.");
                    queryParams.put(key, value);
                }
                viSearchHttpClient.get(ENDPOINT_SEND_ACTIONS, queryParams);
            }
        });
    }
1349096
protected function dispatch(string $eventIdentifier, ...$eventPayload): void
    {
        if (!isset($this->eventCallbacks[$eventIdentifier])) {
            return;
        }
        /** @var \Closure $callback */
        foreach ($this->eventCallbacks[$eventIdentifier] as $callback) {
            call_user_func_array($callback, $eventPayload);
        }
    }
751032
private synchronized void sendPayloadRequest(final PayloadData payload) {
		ApptentiveLog.v(PAYLOADS, "Sending payload: %s", payload);

		// create request object
		final HttpRequest payloadRequest = requestSender.createPayloadSendRequest(payload, new HttpRequest.Listener<HttpRequest>() {
			@Override
			public void onFinish(HttpRequest request) {
				try {
					String json = StringUtils.isNullOrEmpty(request.getResponseData()) ? "{}" : request.getResponseData();
					final JSONObject responseData = new JSONObject(json);
					handleFinishSendingPayload(payload, false, null, request.getResponseCode(), responseData);
				} catch (Exception e) {
					// TODO: Stop assuming the response is JSON. In fact, just send bytes back, and whatever part of the SDK needs it can try to convert it to the desired format.
					ApptentiveLog.e(PAYLOADS, e, "Exception while handling payload send response");
					logException(e);

					handleFinishSendingPayload(payload, false, null, -1, null);
				}
			}

			@Override
			public void onCancel(HttpRequest request) {
				handleFinishSendingPayload(payload, true, null, request.getResponseCode(), null);
			}

			@Override
			public void onFail(HttpRequest request, String reason) {
				if (request.isAuthenticationFailure()) {
					ApptentiveNotificationCenter.defaultCenter().postNotification(NOTIFICATION_AUTHENTICATION_FAILED, NOTIFICATION_KEY_CONVERSATION_ID, payload.getConversationId(), NOTIFICATION_KEY_AUTHENTICATION_FAILED_REASON, request.getAuthenticationFailedReason());
				}
				handleFinishSendingPayload(payload, false, reason, request.getResponseCode(), null);
			}
		});

		// set 'retry' policy
		payloadRequest.setRetryPolicy(requestRetryPolicy);
		payloadRequest.setCallbackQueue(conversationQueue());
		payloadRequest.start();
	}
739285
def send(self, event):
        
        try:
            processed_event = self.process_event(event)
        except EventEmissionExit:
            return
        else:
            self.send_to_backends(processed_event)
876809
function sendEvent(eventName, sendRecursiveArguments, isUnhandledPass) {
  sendRecursiveArguments.unshift(eventName, this.get('currentState'), isUnhandledPass);
  return sendRecursively.apply(this, sendRecursiveArguments);
}
773582
public boolean process(ContentEvent event) {
		InstanceContentEvent inEvent = (InstanceContentEvent) event; //((s4Event) event).getContentEvent();
		//InstanceEvent inEvent = (InstanceEvent) event;

		if (inEvent.getInstanceIndex() < 0) {
			// End learning
			predictionStream.put(event);
			return false;
		}


                if (inEvent.isTesting()){ 
			Instance trainInst = inEvent.getInstance();
			for (int i = 0; i < sizeEnsemble; i++) {
				Instance weightedInst = trainInst.copy();
				//weightedInst.setWeight(trainInst.weight() * k);
				InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
						inEvent.getInstanceIndex(), weightedInst, false, true);
				instanceContentEvent.setClassifierIndex(i);
				instanceContentEvent.setEvaluationIndex(inEvent.getEvaluationIndex());	
				predictionStream.put(instanceContentEvent);
			}
		}
                
                		/* Estimate model parameters using the training data. */
		if (inEvent.isTraining()) {
			train(inEvent);
		} 
		return false;
	}
301830
public void sendEvent(String eventId, Set<Privilege> privileges) {
        // TODO do not use yml in json events...
        String ymlPrivileges = PrivilegeMapper.privilegesToYml(privileges);

        SystemEvent event = buildSystemEvent(eventId, ymlPrivileges);
        serializeEvent(event).ifPresent(this::send);
    }
888718
@Override
    public void sendEvents(TreeSet<Event> events) {
        if (events == null) {
            throw new IllegalArgumentException("Events must be not null");
        }
        if (events.isEmpty()) {
            return;
        }

        addEvents(events);

        if (distributed) {
            partitionManager.notifyEvents(new ArrayList<>(events));
        }
    }