Github user haoch commented on a diff in the pull request:

    https://github.com/apache/incubator-eagle/pull/556#discussion_r84639212
  
    --- Diff: 
eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
 ---
    @@ -96,44 +103,63 @@ public void close() {
         }
     
         @SuppressWarnings( {"rawtypes", "unchecked"})
    -    protected PublishStatus emit(String topic, List<AlertStreamEvent> 
outputEvents) {
    +    protected void emit(String topic, List<AlertStreamEvent> outputEvents) 
{
             // we need to check producer here since the producer is invisable 
to extended kafka publisher
             if (producer == null) {
                 LOG.warn("KafkaProducer is null due to the incorrect 
configurations");
    -            return null;
    +            return;
             }
             if (outputEvents == null) {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Alert stream events list in publishment is 
empty");
                 }
    -            return null;
    +            return;
             }
             this.status = new PublishStatus();
             try {
                 for (AlertStreamEvent outputEvent : outputEvents) {
                     ProducerRecord record = createRecord(outputEvent, topic);
                     if (record == null) {
                         LOG.error("Alert serialize return null, ignored 
message! ");
    -                    return null;
    +                    return;
    +                }
    +                if (mode == KafkaWriteMode.sync) {
    +                    Future<?> future = producer.send(record);
    +                    future.get(MAX_TIMEOUT_MS, TimeUnit.MILLISECONDS);
    +                    succeed(mode, "");
    +                } else {
    +                    producer.send(record, new Callback() {
    --- End diff --
    
    This is not `async` mode in kafka language


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to