Package org.apache.kafka.streams.test
Class ConsumerRecordFactory<K,V>
- java.lang.Object
-
- org.apache.kafka.streams.test.ConsumerRecordFactory<K,V>
-
- Type Parameters:
K
- the type of the keyV
- the type of the value
@Deprecated public class ConsumerRecordFactory<K,V> extends Object
Deprecated.Since 2.4 use methods ofTestInputTopic
insteadFactory to createconsumer records
for a single single-partitioned topic with given key and valueserializers
.- See Also:
TopologyTestDriver
-
-
Constructor Summary
Constructors Constructor Description ConsumerRecordFactory(String defaultTopicName, Serializer<K> keySerializer, Serializer<V> valueSerializer)
Deprecated.Create a new factory for the given topic.ConsumerRecordFactory(String defaultTopicName, Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs)
Deprecated.Create a new factory for the given topic.ConsumerRecordFactory(String defaultTopicName, Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs, long autoAdvanceMs)
Deprecated.Create a new factory for the given topic.ConsumerRecordFactory(Serializer<K> keySerializer, Serializer<V> valueSerializer)
Deprecated.Create a new factory for the given topic.ConsumerRecordFactory(Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs)
Deprecated.Create a new factory for the given topic.ConsumerRecordFactory(Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs, long autoAdvanceMs)
Deprecated.Create a new factory for the given topic.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
advanceTimeMs(long advanceMs)
Deprecated.Advances the internally tracked time.List<ConsumerRecord<byte[],byte[]>>
create(String topicName, List<KeyValue<K,V>> keyValues)
Deprecated.Createsconsumer records
with the given topic name, keys, and values.List<ConsumerRecord<byte[],byte[]>>
create(String topicName, List<KeyValue<K,V>> keyValues, long startTimestamp)
Deprecated.Createsconsumer records
with the given topic name, keys and values.List<ConsumerRecord<byte[],byte[]>>
create(String topicName, List<KeyValue<K,V>> keyValues, long startTimestamp, long advanceMs)
Deprecated.Createsconsumer records
with the given topic name, keys, and values.ConsumerRecord<byte[],byte[]>
create(String topicName, K key, V value)
Deprecated.Create aConsumerRecord
with the given topic name, key, and value.ConsumerRecord<byte[],byte[]>
create(String topicName, K key, V value, long timestampMs)
Deprecated.Create aConsumerRecord
with the given topic name and given topic, key, value, and timestamp.ConsumerRecord<byte[],byte[]>
create(String topicName, K key, V value, Headers headers)
Deprecated.Create aConsumerRecord
with the given topic name, key, value, and headers.ConsumerRecord<byte[],byte[]>
create(String topicName, K key, V value, Headers headers, long timestampMs)
Deprecated.Create aConsumerRecord
with the given topic name, key, value, headers, and timestamp.ConsumerRecord<byte[],byte[]>
create(String topicName, V value)
Deprecated.Create aConsumerRecord
withnull
-key and the given topic name and value.ConsumerRecord<byte[],byte[]>
create(String topicName, V value, long timestampMs)
Deprecated.Create aConsumerRecord
withnull
-key and the given topic name, value, and timestamp.ConsumerRecord<byte[],byte[]>
create(String topicName, V value, Headers headers)
Deprecated.Create aConsumerRecord
withnull
-key and the given topic name, value, and headers.ConsumerRecord<byte[],byte[]>
create(String topicName, V value, Headers headers, long timestampMs)
Deprecated.Create aConsumerRecord
withnull
-key and the given topic name, value, headers, and timestamp.List<ConsumerRecord<byte[],byte[]>>
create(List<KeyValue<K,V>> keyValues)
Deprecated.Createsconsumer records
with default topic name as well as given keys and values.List<ConsumerRecord<byte[],byte[]>>
create(List<KeyValue<K,V>> keyValues, long startTimestamp)
Deprecated.Createsconsumer records
with the given keys and values.List<ConsumerRecord<byte[],byte[]>>
create(List<KeyValue<K,V>> keyValues, long startTimestamp, long advanceMs)
Deprecated.Createsconsumer records
with default topic name as well as given keys and values.ConsumerRecord<byte[],byte[]>
create(K key, V value)
Deprecated.Create aConsumerRecord
with default topic name and given key and value.ConsumerRecord<byte[],byte[]>
create(K key, V value, long timestampMs)
Deprecated.Create aConsumerRecord
with default topic name and given key, value, and timestamp.ConsumerRecord<byte[],byte[]>
create(K key, V value, Headers headers)
Deprecated.Create aConsumerRecord
with default topic name and given key, value, and headers.ConsumerRecord<byte[],byte[]>
create(K key, V value, Headers headers, long timestampMs)
Deprecated.Create aConsumerRecord
with default topic name and given key, value, headers, and timestamp.ConsumerRecord<byte[],byte[]>
create(V value)
Deprecated.Create aConsumerRecord
with default topic name andnull
-key was well as given value.ConsumerRecord<byte[],byte[]>
create(V value, long timestampMs)
Deprecated.Create aConsumerRecord
with default topic name andnull
-key as well as given value and timestamp.ConsumerRecord<byte[],byte[]>
create(V value, Headers headers)
Deprecated.Create aConsumerRecord
with default topic name andnull
-key was well as given value and headers.ConsumerRecord<byte[],byte[]>
create(V value, Headers headers, long timestampMs)
Deprecated.Create aConsumerRecord
with default topic name andnull
-key as well as given value, headers, and timestamp.
-
-
-
Constructor Detail
-
ConsumerRecordFactory
public ConsumerRecordFactory(Serializer<K> keySerializer, Serializer<V> valueSerializer)
Deprecated.Create a new factory for the given topic. Uses current system time as start timestamp. Auto-advance is disabled.- Parameters:
keySerializer
- the key serializervalueSerializer
- the value serializer
-
ConsumerRecordFactory
public ConsumerRecordFactory(String defaultTopicName, Serializer<K> keySerializer, Serializer<V> valueSerializer)
Deprecated.Create a new factory for the given topic. Uses current system time as start timestamp. Auto-advance is disabled.- Parameters:
defaultTopicName
- the default topic name used for all generatedconsumer records
keySerializer
- the key serializervalueSerializer
- the value serializer
-
ConsumerRecordFactory
public ConsumerRecordFactory(Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs)
Deprecated.Create a new factory for the given topic. Auto-advance is disabled.- Parameters:
keySerializer
- the key serializervalueSerializer
- the value serializerstartTimestampMs
- the initial timestamp for generated records
-
ConsumerRecordFactory
public ConsumerRecordFactory(String defaultTopicName, Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs)
Deprecated.Create a new factory for the given topic. Auto-advance is disabled.- Parameters:
defaultTopicName
- the topic name used for all generatedconsumer records
keySerializer
- the key serializervalueSerializer
- the value serializerstartTimestampMs
- the initial timestamp for generated records
-
ConsumerRecordFactory
public ConsumerRecordFactory(Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs, long autoAdvanceMs)
Deprecated.Create a new factory for the given topic.- Parameters:
keySerializer
- the key serializervalueSerializer
- the value serializerstartTimestampMs
- the initial timestamp for generated recordsautoAdvanceMs
- the time increment pre generated record
-
ConsumerRecordFactory
public ConsumerRecordFactory(String defaultTopicName, Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs, long autoAdvanceMs)
Deprecated.Create a new factory for the given topic.- Parameters:
defaultTopicName
- the topic name used for all generatedconsumer records
keySerializer
- the key serializervalueSerializer
- the value serializerstartTimestampMs
- the initial timestamp for generated recordsautoAdvanceMs
- the time increment pre generated record
-
-
Method Detail
-
advanceTimeMs
public void advanceTimeMs(long advanceMs)
Deprecated.Advances the internally tracked time.- Parameters:
advanceMs
- the amount of time to advance
-
create
public ConsumerRecord<byte[],byte[]> create(String topicName, K key, V value, Headers headers, long timestampMs)
Deprecated.Create aConsumerRecord
with the given topic name, key, value, headers, and timestamp. Does not auto advance internally tracked time.- Parameters:
topicName
- the topic namekey
- the record keyvalue
- the record valueheaders
- the record headerstimestampMs
- the record timestamp- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(String topicName, K key, V value, long timestampMs)
Deprecated.Create aConsumerRecord
with the given topic name and given topic, key, value, and timestamp. Does not auto advance internally tracked time.- Parameters:
topicName
- the topic namekey
- the record keyvalue
- the record valuetimestampMs
- the record timestamp- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(K key, V value, long timestampMs)
Deprecated.Create aConsumerRecord
with default topic name and given key, value, and timestamp. Does not auto advance internally tracked time.- Parameters:
key
- the record keyvalue
- the record valuetimestampMs
- the record timestamp- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(K key, V value, Headers headers, long timestampMs)
Deprecated.Create aConsumerRecord
with default topic name and given key, value, headers, and timestamp. Does not auto advance internally tracked time.- Parameters:
key
- the record keyvalue
- the record valueheaders
- the record headerstimestampMs
- the record timestamp- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(String topicName, K key, V value)
Deprecated.Create aConsumerRecord
with the given topic name, key, and value. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
topicName
- the topic namekey
- the record keyvalue
- the record value- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(String topicName, K key, V value, Headers headers)
Deprecated.Create aConsumerRecord
with the given topic name, key, value, and headers. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
topicName
- the topic namekey
- the record keyvalue
- the record valueheaders
- the record headers- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(K key, V value)
Deprecated.Create aConsumerRecord
with default topic name and given key and value. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
key
- the record keyvalue
- the record value- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(K key, V value, Headers headers)
Deprecated.Create aConsumerRecord
with default topic name and given key, value, and headers. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
key
- the record keyvalue
- the record valueheaders
- the record headers- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(String topicName, V value, long timestampMs)
Deprecated.Create aConsumerRecord
withnull
-key and the given topic name, value, and timestamp. Does not auto advance internally tracked time.- Parameters:
topicName
- the topic namevalue
- the record valuetimestampMs
- the record timestamp- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(String topicName, V value, Headers headers, long timestampMs)
Deprecated.Create aConsumerRecord
withnull
-key and the given topic name, value, headers, and timestamp. Does not auto advance internally tracked time.- Parameters:
topicName
- the topic namevalue
- the record valueheaders
- the record headerstimestampMs
- the record timestamp- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(V value, long timestampMs)
Deprecated.Create aConsumerRecord
with default topic name andnull
-key as well as given value and timestamp. Does not auto advance internally tracked time.- Parameters:
value
- the record valuetimestampMs
- the record timestamp- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(V value, Headers headers, long timestampMs)
Deprecated.Create aConsumerRecord
with default topic name andnull
-key as well as given value, headers, and timestamp. Does not auto advance internally tracked time.- Parameters:
value
- the record valueheaders
- the record headerstimestampMs
- the record timestamp- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(String topicName, V value, Headers headers)
Deprecated.Create aConsumerRecord
withnull
-key and the given topic name, value, and headers. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
topicName
- the topic namevalue
- the record valueheaders
- the record headers- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(String topicName, V value)
Deprecated.Create aConsumerRecord
withnull
-key and the given topic name and value. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
topicName
- the topic namevalue
- the record value- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(V value)
Deprecated.Create aConsumerRecord
with default topic name andnull
-key was well as given value. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
value
- the record value- Returns:
- the generated
ConsumerRecord
-
create
public ConsumerRecord<byte[],byte[]> create(V value, Headers headers)
Deprecated.Create aConsumerRecord
with default topic name andnull
-key was well as given value and headers. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
value
- the record valueheaders
- the record headers- Returns:
- the generated
ConsumerRecord
-
create
public List<ConsumerRecord<byte[],byte[]>> create(String topicName, List<KeyValue<K,V>> keyValues)
Deprecated.Createsconsumer records
with the given topic name, keys, and values. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
topicName
- the topic namekeyValues
- the record keys and values- Returns:
- the generated
consumer records
-
create
public List<ConsumerRecord<byte[],byte[]>> create(List<KeyValue<K,V>> keyValues)
Deprecated.Createsconsumer records
with default topic name as well as given keys and values. The timestamp will be generated based on the constructor provided start time and time will auto advance.- Parameters:
keyValues
- the record keys and values- Returns:
- the generated
consumer records
-
create
public List<ConsumerRecord<byte[],byte[]>> create(String topicName, List<KeyValue<K,V>> keyValues, long startTimestamp, long advanceMs)
Deprecated.Createsconsumer records
with the given topic name, keys, and values. Does not auto advance internally tracked time.- Parameters:
topicName
- the topic namekeyValues
- the record keys and valuesstartTimestamp
- the timestamp for the first generated recordadvanceMs
- the time difference between two consecutive generated records- Returns:
- the generated
consumer records
-
create
public List<ConsumerRecord<byte[],byte[]>> create(List<KeyValue<K,V>> keyValues, long startTimestamp, long advanceMs)
Deprecated.Createsconsumer records
with default topic name as well as given keys and values. Does not auto advance internally tracked time.- Parameters:
keyValues
- the record keys and valuesstartTimestamp
- the timestamp for the first generated recordadvanceMs
- the time difference between two consecutive generated records- Returns:
- the generated
consumer records
-
create
public List<ConsumerRecord<byte[],byte[]>> create(String topicName, List<KeyValue<K,V>> keyValues, long startTimestamp)
Deprecated.Createsconsumer records
with the given topic name, keys and values. For each generated record, the time is advanced by 1. Does not auto advance internally tracked time.- Parameters:
topicName
- the topic namekeyValues
- the record keys and valuesstartTimestamp
- the timestamp for the first generated record- Returns:
- the generated
consumer records
-
create
public List<ConsumerRecord<byte[],byte[]>> create(List<KeyValue<K,V>> keyValues, long startTimestamp)
Deprecated.Createsconsumer records
with the given keys and values. For each generated record, the time is advanced by 1. Does not auto advance internally tracked time.- Parameters:
keyValues
- the record keys and valuesstartTimestamp
- the timestamp for the first generated record- Returns:
- the generated
consumer records
-
-