Push all keyed messages to the Kafka topic.
@param messages List of keyed messages to push to Kakfa.
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());
    }
  }
61520
public boolean addMessageListener(String topic, IKafkaMessageListener messageListener,
            boolean autoCommitOffsets) {
        synchronized (topicMsgListeners) {
            if (topicMsgListeners.put(topic, messageListener)) {
                _getWorker(topic, autoCommitOffsets);
                return true;
            }
        }
        return false;
    }
1146820
public void setTopics(java.util.Collection<Topic> topics) {
        if (topics == null) {
            this.topics = null;
            return;
        }

        this.topics = new com.amazonaws.internal.SdkInternalList<Topic>(topics);
    }
1176619
public void pushMessages(List<byte[]> messages) {
    for (byte[] message: messages) {
      producer.send(new ProducerRecord<>(topic, message), (recordMetadata, e) -> {
        if (e != null) {
          log.error("Failed to send message to topic {} due to exception: ", topic, e);
        }
      });
    }
  }
684895
public boolean commit(KafkaMessage msg) {
        KafkaConsumer<String, byte[]> consumer = _getConsumer(msg.topic());
        synchronized (consumer) {
            Set<String> subscription = consumer.subscription();
            if (subscription == null || !subscription.contains(msg.topic())) {
                // this consumer has not subscribed to the topic
                return false;
            } else {
                try {
                    Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>();
                    offsets.put(new TopicPartition(msg.topic(), msg.partition()),
                            new OffsetAndMetadata(msg.offset() + 1));
                    consumer.commitSync(offsets);
                } catch (WakeupException e) {
                } catch (Exception e) {
                    throw new KafkaException(e);
                }
                return true;
            }
        }
    }
868733
protected void createKafkaTopics(Set<String> topics) {
        Map<String, Object> adminConfigs = new HashMap<>();
        adminConfigs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:" + kafkaServerPort);
        try (AdminClient admin = AdminClient.create(adminConfigs)) {
            List<NewTopic> newTopics = topics.stream()
                    .map(t -> new NewTopic(t, partitions, (short) 1))
                    .collect(Collectors.toList());
            CreateTopicsResult createTopics = admin.createTopics(newTopics);
            try {
                createTopics.all().get();
            } catch (Exception e) {
                log.warn("Failed to create Kafka topics", e);
            }
        }
    }
1105677
@Override
    public void sendPushMessage(Variant variant, Collection<String> tokens, UnifiedPushMessage pushMessage, String pushMessageInformationId, NotificationSenderCallback callback) {

        // no need to send empty list
        if (tokens.isEmpty()) {
            return;
        }

        final List<String> pushTargets = new ArrayList<>(tokens);
        final AndroidVariant androidVariant = (AndroidVariant) variant;

        // payload builder:
        Builder fcmBuilder = new Message.Builder();

        org.jboss.aerogear.unifiedpush.message.Message message = pushMessage.getMessage();
        // add the "recognized" keys...
        fcmBuilder.addData("alert", message.getAlert());
        fcmBuilder.addData("sound", message.getSound());
        fcmBuilder.addData("badge", String.valueOf(message.getBadge()));

        /*
        The Message defaults to a Normal priority.  High priority is used
        by FCM to wake up devices in Doze mode as well as apps in AppStandby
        mode.  This has no effect on devices older than Android 6.0
        */
        fcmBuilder.priority(
                message.getPriority() ==  Priority.HIGH ?
                                          Message.Priority.HIGH :
                                          Message.Priority.NORMAL
                           );

        // if present, apply the time-to-live metadata:
        int ttl = pushMessage.getConfig().getTimeToLive();
        if (ttl != -1) {
            fcmBuilder.timeToLive(ttl);
        }

        // iterate over the missing keys:
        message.getUserData().keySet()
                .forEach(key -> fcmBuilder.addData(key, String.valueOf(message.getUserData().get(key))));

        //add the aerogear-push-id
        fcmBuilder.addData(InternalUnifiedPushMessage.PUSH_MESSAGE_ID, pushMessageInformationId);

        Message fcmMessage = fcmBuilder.build();

        // send it out.....
        try {
            logger.debug("Sending transformed FCM payload: {}", fcmMessage);

            final ConfigurableFCMSender sender = new ConfigurableFCMSender(androidVariant.getGoogleKey());

            // we are about to send HTTP requests for all tokens of topics of this batch
            promPrushRequestsAndroid.inc();

            // send out a message to a batch of devices...
            processFCM(androidVariant, pushTargets, fcmMessage , sender);

            logger.debug("Message batch to FCM has been submitted");
            callback.onSuccess();

        } catch (Exception e) {
            // FCM exceptions:
            callback.onError(String.format("Error sending payload to FCM server: %s", e.getMessage()));
        }
    }
611276
public void removeActiveMessages(int messages)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this,tc, "removeActiveMessages", new Object[] {Integer.valueOf(messages)});

    // If we're a member of a ConsumerSet, inform them of the remove
    if(classifyingMessages)
      consumerSet.removeActiveMessages(messages);

    if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(this,tc, "removeActiveMessages");
  }
860175
protected void putToRingBuffer(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull {
        if (msg == null) {
            throw new NullPointerException("Supplied queue message is null!");
        }
        LOCK_PUT.lock();
        try {
            if (!ringBuffer.tryPublishEvent((event, _seq) -> {
                event.set(msg);
                knownPublishedSeq = _seq > knownPublishedSeq ? _seq : knownPublishedSeq;
            })) {
                throw new QueueException.QueueIsFull(getRingSize());
            }
        } finally {
            LOCK_PUT.unlock();
        }
    }
1187605
def add(message, partition_id)
      @messages << message

      @topics[message.topic] ||= {}
      @topics[message.topic][partition_id] ||= []
      @topics[message.topic][partition_id] << message
    end
443391
private void doKeySet(final Message<JsonObject> message) {
    final String key = message.body().getString("name");
    if (key == null) {
      message.reply(new JsonObject().putString("status", "error").putString("message", "No key specified."));
      return;
    }

    final Object value = message.body().getValue("value");

    context.execute(new Action<Void>() {
      @Override
      public Void perform() {
        data.getMap(formatKey("keys")).put(key, value);
        return null;
      }
    }, new Handler<AsyncResult<Void>>() {
      @Override
      public void handle(AsyncResult<Void> result) {
        if (result.failed()) {
          message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
        } else {
          message.reply(new JsonObject().putString("status", "ok"));
        }
      }
    });
  }
199201
protected void addMessage(String message)
    {
        messages.add(message);
        messageCount++;
        if (messageCount > messagesQueueMax)
        {
            messages.remove();
            messageCount--;
        }
    }
588235
public static void puts(Object... messages) {

        for (Object message : messages) {
            IO.print(message);
            if (!(message instanceof Terminal.Escape)) IO.print(' ');
        }
        IO.println();

    }
475642
public function addMessage($key, $message)
    {
        // Create Array for this key
        if (!isset($this->storage[$this->storageKey][$key])) {
            $this->storage[$this->storageKey][$key] = [];
        }

        // Push onto the array
        $this->storage[$this->storageKey][$key][] = $message;
    }
1164890
@Override
    public <T> void send(NotificationType type, List<T> messages) throws NotificationException {
        String[] strMessages = new String[messages.size()];
        for (int index = 0; index < messages.size(); index++) {
            strMessages[index] = getMessageJson(messages.get(index));
        }
        sendInternal(type, strMessages);
    }
1341194
public void publishInternal(Object message) {
        topicStats.incrementPublishes();
        topicService.publishMessage(name, message, multithreaded);
    }
1023647
def send(self, message, *args, **kwargs):
        '''
        
        '''
        self._messages.put((message, args, kwargs), False)