Commit 96f2c299 by Madhan Neethiraj

ATLAS-2844: added eventTime field in EntityNotificationV2

parent 56eefb2a
...@@ -105,16 +105,22 @@ public class EntityNotification implements Serializable { ...@@ -105,16 +105,22 @@ public class EntityNotification implements Serializable {
private AtlasEntityHeader entity; private AtlasEntityHeader entity;
private OperationType operationType; private OperationType operationType;
private long eventTime;
public EntityNotificationV2() { public EntityNotificationV2() {
super(ENTITY_NOTIFICATION_V2); this(null, null, System.currentTimeMillis());
} }
public EntityNotificationV2(AtlasEntityHeader entity, OperationType operationType) { public EntityNotificationV2(AtlasEntityHeader entity, OperationType operationType) {
this(entity, operationType, System.currentTimeMillis());
}
public EntityNotificationV2(AtlasEntityHeader entity, OperationType operationType, long eventTime) {
super(ENTITY_NOTIFICATION_V2); super(ENTITY_NOTIFICATION_V2);
setEntity(entity); setEntity(entity);
setOperationType(operationType); setOperationType(operationType);
setEventTime(eventTime);
} }
public AtlasEntityHeader getEntity() { public AtlasEntityHeader getEntity() {
...@@ -133,6 +139,14 @@ public class EntityNotification implements Serializable { ...@@ -133,6 +139,14 @@ public class EntityNotification implements Serializable {
this.operationType = operationType; this.operationType = operationType;
} }
public long getEventTime() {
return eventTime;
}
public void setEventTime(long eventTime) {
this.eventTime = eventTime;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) { return true; } if (this == o) { return true; }
...@@ -163,6 +177,7 @@ public class EntityNotification implements Serializable { ...@@ -163,6 +177,7 @@ public class EntityNotification implements Serializable {
sb.append(entity); sb.append(entity);
} }
sb.append(", operationType=").append(operationType); sb.append(", operationType=").append(operationType);
sb.append(", eventTime=").append(eventTime);
sb.append("}"); sb.append("}");
return sb; return sb;
......
...@@ -125,7 +125,7 @@ public class EntityNotificationListenerV2 implements EntityChangeListenerV2 { ...@@ -125,7 +125,7 @@ public class EntityNotificationListenerV2 implements EntityChangeListenerV2 {
continue; continue;
} }
messages.add(new EntityNotificationV2(toNotificationHeader(entity), operationType)); messages.add(new EntityNotificationV2(toNotificationHeader(entity), operationType, RequestContext.get().getRequestTime()));
} }
if (!messages.isEmpty()) { if (!messages.isEmpty()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment