Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #193 add timestamp to the CosumerRecord class #194

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ConsumerRecord<K, V> {
V value;
int partition;
long offset;
long timestamp;
Map<String, String> headers;

ConsumerRecord() {
Expand All @@ -37,6 +38,16 @@ public ConsumerRecord(String topic, K key, V value, Map<String, String> headers,
this.offset = offset;
}

public ConsumerRecord(String topic, K key, V value, Map<String, String> headers, int partition, long offset, long timestamp) {
this.topic = topic;
this.key = key;
this.value = value;
this.headers = headers;
this.partition = partition;
this.offset = offset;
this.timestamp = timestamp;
}

public String getTopic() {
return topic;
}
Expand All @@ -59,8 +70,17 @@ public long getOffset() {
return offset;
}

public long getTimestamp() {
return timestamp;
}

public static <K, V> ConsumerRecord<K, V> create(
String topic, K key, V value, Map<String, String> headers, int partition, long offset) {
return new ConsumerRecord<>(topic, key, value, headers, partition, offset);
}
public static <K, V> ConsumerRecord<K, V> create(
String topic, K key, V value, Map<String, String> headers, int partition, long offset, long timestamp) {
return new ConsumerRecord<>(topic, key, value, headers, partition, offset, timestamp);
}

}