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 Object
A key/value pair, including timestamp and record headers, to be sent to or received from
TopologyTestDriver
.
If [a] record does not contain a timestamp,
TestInputTopic
will 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, Instant recordTime)
Creates a record.TestRecord(K key, V value, Headers headers)
Creates a record.TestRecord(K key, V value, Headers headers, Long timestampMs)
Creates a record.TestRecord(K key, V value, Headers headers, Instant recordTime)
Creates a record.TestRecord(ConsumerRecord<K,V> record)
Create aTestRecord
from aConsumerRecord
.TestRecord(ProducerRecord<K,V> record)
Create aTestRecord
from aProducerRecord
.TestRecord(V value)
Create a record withnull
key. -
Method Summary
-
Constructor Details
-
TestRecord
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
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
Creates a record.- Parameters:
key
- The key of the recordvalue
- The value of the recordrecordTime
- The timestamp of the record as Instant.
-
TestRecord
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
Creates a record.- Parameters:
key
- The key of the recordvalue
- The value of the record
-
TestRecord
Create a record withnull
key.- Parameters:
value
- The value of the record
-
TestRecord
Create aTestRecord
from aConsumerRecord
.- Parameters:
record
- The v
-
TestRecord
Create aTestRecord
from aProducerRecord
.- Parameters:
record
- The record contents
-
-
Method Details
-
headers
- Returns:
- The headers.
-
key
- Returns:
- The key (or
null
if no key is specified).
-
value
- Returns:
- The value.
-
timestamp
- Returns:
- The timestamp, which is in milliseconds since epoch.
-
getHeaders
- Returns:
- The headers.
-
getKey
- Returns:
- The key (or null if no key is specified)
-
getValue
- Returns:
- The value.
-
getRecordTime
- Returns:
- The timestamp.
-
toString
-
equals
-
hashCode
public int hashCode()
-