Skip to content

Commit

Permalink
chore: unify the event time of messages to drop (#76)
Browse files Browse the repository at this point in the history
Set the event time of messages to drop to epoch(0) - 1ms across all our SDKs.

Signed-off-by: Keran Yang <[email protected]>
  • Loading branch information
KeranYang authored Oct 13, 2023
1 parent ac22d02 commit 99a3667
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ buildNumber.properties

# IDE
.vscode/
.DS_Store
*/**/.DS_Store
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<version>1.18.30</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
@Getter
public class Message {
public static final String DROP = "U+005C__DROP__";


// Watermark are at millisecond granularity, hence we use epoch(0) - 1 to indicate watermark is not available.
// EventTimeForDrop is used to indicate that the message is dropped hence, excluded from watermark calculation
private static final Instant EventTimeForDrop = Instant.ofEpochMilli(-1);
private final String[] keys;
private final byte[] value;
private final Instant eventTime;
Expand Down Expand Up @@ -60,6 +61,10 @@ public Message(byte[] value, Instant eventTime, String[] keys) {
* @return returns the Message which will be dropped
*/
public static Message toDrop() {
return new Message(new byte[0], Instant.MIN, null, new String[]{DROP});
return new Message(
new byte[0],
EventTimeForDrop,
null,
new String[]{DROP});
}
}

0 comments on commit 99a3667

Please sign in to comment.