Package org.apache.kafka.streams.test
Class TestRecord<K,V>
- java.lang.Object
-
- org.apache.kafka.streams.test.TestRecord<K,V>
-
public class TestRecord<K,V> extends java.lang.ObjectA key/value pair, including timestamp and record headers, to be sent to or received fromTopologyTestDriver. If [a] record does not contain a timestamp,TestInputTopicwill auto advance it's time when the record is piped.
-
-
Constructor Summary
Constructors Constructor Description TestRecord(K key, V value)Creates a record.TestRecord(K key, V value, java.time.Instant recordTime)Creates a record.TestRecord(K key, V value, org.apache.kafka.common.header.Headers headers)Creates a record.TestRecord(K key, V value, org.apache.kafka.common.header.Headers headers, java.lang.Long timestampMs)Creates a record.TestRecord(K key, V value, org.apache.kafka.common.header.Headers headers, java.time.Instant recordTime)Creates a record.TestRecord(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)Create aTestRecordfrom aConsumerRecord.TestRecord(org.apache.kafka.clients.producer.ProducerRecord<K,V> record)Create aTestRecordfrom aProducerRecord.TestRecord(V value)Create a record withnullkey.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)org.apache.kafka.common.header.HeadersgetHeaders()KgetKey()java.time.InstantgetRecordTime()VgetValue()inthashCode()org.apache.kafka.common.header.Headersheaders()Kkey()java.lang.Longtimestamp()java.lang.StringtoString()Vvalue()
-
-
-
Constructor Detail
-
TestRecord
public TestRecord(K key, V value, org.apache.kafka.common.header.Headers headers, java.time.Instant recordTime)
Creates a record.- Parameters:
key- The key that will be included in the recordvalue- The value of the recordheaders- the record headers that will be included in the recordrecordTime- The timestamp of the record.
-
TestRecord
public TestRecord(K key, V value, org.apache.kafka.common.header.Headers headers, java.lang.Long timestampMs)
Creates a record.- Parameters:
key- The key that will be included in the recordvalue- The value of the recordheaders- the record headers that will be included in the recordtimestampMs- The timestamp of the record, in milliseconds since the beginning of the epoch.
-
TestRecord
public TestRecord(K key, V value, java.time.Instant recordTime)
Creates a record.- Parameters:
key- The key of the recordvalue- The value of the recordrecordTime- The timestamp of the record as Instant.
-
TestRecord
public TestRecord(K key, V value, org.apache.kafka.common.header.Headers headers)
Creates a record.- Parameters:
key- The key of the recordvalue- The value of the recordheaders- The record headers that will be included in the record
-
TestRecord
public TestRecord(K key, V value)
Creates a record.- Parameters:
key- The key of the recordvalue- The value of the record
-
TestRecord
public TestRecord(V value)
Create a record withnullkey.- Parameters:
value- The value of the record
-
TestRecord
public TestRecord(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
Create aTestRecordfrom aConsumerRecord.- Parameters:
record- The v
-
-
Method Detail
-
headers
public org.apache.kafka.common.header.Headers headers()
- Returns:
- The headers.
-
key
public K key()
- Returns:
- The key (or
nullif no key is specified).
-
value
public V value()
- Returns:
- The value.
-
timestamp
public java.lang.Long timestamp()
- Returns:
- The timestamp, which is in milliseconds since epoch.
-
getHeaders
public org.apache.kafka.common.header.Headers getHeaders()
- Returns:
- The headers.
-
getKey
public K getKey()
- Returns:
- The key (or null if no key is specified)
-
getValue
public V getValue()
- Returns:
- The value.
-
getRecordTime
public java.time.Instant getRecordTime()
- Returns:
- The timestamp.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-