eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ralp...@apache.org
Subject incubator-eagle git commit: [EAGLE-589] : PR 472 incorrect merge of pr 471
Date Tue, 04 Oct 2016 21:38:42 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 17cb77f3a -> f12c82f8a


[EAGLE-589] : PR 472 incorrect merge of pr 471

Author: ralphsu

This closes #474


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/f12c82f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/f12c82f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/f12c82f8

Branch: refs/heads/master
Commit: f12c82f8ae354bad96c40ab778cb38600947559f
Parents: 17cb77f
Author: Ralph, Su <suliangfei@gmail.com>
Authored: Wed Oct 5 05:29:51 2016 +0800
Committer: Ralph, Su <suliangfei@gmail.com>
Committed: Wed Oct 5 05:38:42 2016 +0800

----------------------------------------------------------------------
 .../eagle/alert/engine/model/AlertStreamEvent.java   | 15 +++++++++++++++
 .../apache/eagle/alert/engine/model/StreamEvent.java | 13 +++++++------
 .../engine/publisher/impl/AlertKafkaPublisher.java   |  6 ++++--
 3 files changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f12c82f8/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/AlertStreamEvent.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/AlertStreamEvent.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/AlertStreamEvent.java
index a503dcf..ef3f71c 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/AlertStreamEvent.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/AlertStreamEvent.java
@@ -33,6 +33,21 @@ public class AlertStreamEvent extends StreamEvent {
     private String createdBy;
     private long createdTime;
 
+    public AlertStreamEvent() {
+    }
+
+    public AlertStreamEvent(AlertStreamEvent event) {
+        this.policyId = event.policyId;
+        this.schema = event.schema;
+        this.createdBy = event.createdBy;
+        this.createdTime = event.createdTime;
+        this.setTimestamp(event.getTimestamp());
+        this.setData(new Object[event.data.length]);
+        System.arraycopy(event.data, 0, this.data, 0, event.data.length);
+        this.setStreamId(event.getStreamId());
+        this.setMetaVersion(event.getMetaVersion());
+    }
+
     public void setPolicyId(String policyId) {
         this.policyId = policyId;
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f12c82f8/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/StreamEvent.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/StreamEvent.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/StreamEvent.java
index d91b001..693050d 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/StreamEvent.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/StreamEvent.java
@@ -16,10 +16,11 @@
  */
 package org.apache.eagle.alert.engine.model;
 
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.utils.DateTimeUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.utils.DateTimeUtil;
+
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -32,10 +33,10 @@ import java.util.Objects;
 public class StreamEvent implements Serializable {
     private static final long serialVersionUID = 2765116509856609763L;
 
-    private String streamId;
-    private Object[] data;
-    private long timestamp;
-    private String metaVersion;
+    protected String streamId;
+    protected Object[] data;
+    protected long timestamp;
+    protected String metaVersion;
 
     public StreamEvent() {
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f12c82f8/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
index e5c351b..5464ded 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
@@ -77,8 +77,10 @@ public class AlertKafkaPublisher extends AbstractPublishPlugin {
             LOG.warn("Namespace column {} is not found, the found index {} is invalid",
                 namespaceLabel, namespaceColumnIndex);
         } else {
-            event.getData()[namespaceColumnIndex] = namespaceValue;
-            outputEvents.add(event);
+            // copy raw event to be duped
+            AlertStreamEvent newEvent = new AlertStreamEvent(event);
+            newEvent.getData()[namespaceColumnIndex] = namespaceValue;
+            outputEvents.add(newEvent);
         }
 
         List<AlertStreamEvent> dedupResults = dedup(event);


Mime
View raw message