K
- the type of the keyV
- the type of the value@Evolving public class ConsumerRecordFactory<K,V> extends java.lang.Object
consumer records
for a single single-partitioned topic with given key and
value serializers
.TopologyTestDriver
Constructor | Description |
---|---|
ConsumerRecordFactory(java.lang.String defaultTopicName,
Serializer<K> keySerializer,
Serializer<V> valueSerializer) |
Create a new factory for the given topic.
|
ConsumerRecordFactory(java.lang.String defaultTopicName,
Serializer<K> keySerializer,
Serializer<V> valueSerializer,
long startTimestampMs) |
Create a new factory for the given topic.
|
ConsumerRecordFactory(java.lang.String defaultTopicName,
Serializer<K> keySerializer,
Serializer<V> valueSerializer,
long startTimestampMs,
long autoAdvanceMs) |
Create a new factory for the given topic.
|
ConsumerRecordFactory(Serializer<K> keySerializer,
Serializer<V> valueSerializer) |
Create a new factory for the given topic.
|
ConsumerRecordFactory(Serializer<K> keySerializer,
Serializer<V> valueSerializer,
long startTimestampMs) |
Create a new factory for the given topic.
|
ConsumerRecordFactory(Serializer<K> keySerializer,
Serializer<V> valueSerializer,
long startTimestampMs,
long autoAdvanceMs) |
Create a new factory for the given topic.
|
Modifier and Type | Method | Description |
---|---|---|
void |
advanceTimeMs(long advanceMs) |
Advances the internally tracked time.
|
java.util.List<ConsumerRecord<byte[],byte[]>> |
create(java.lang.String topicName,
java.util.List<KeyValue<K,V>> keyValues) |
Creates
consumer records with the given topic name, keys, and values. |
java.util.List<ConsumerRecord<byte[],byte[]>> |
create(java.lang.String topicName,
java.util.List<KeyValue<K,V>> keyValues,
long startTimestamp) |
Creates
consumer records with the given topic name, keys and values. |
java.util.List<ConsumerRecord<byte[],byte[]>> |
create(java.lang.String topicName,
java.util.List<KeyValue<K,V>> keyValues,
long startTimestamp,
long advanceMs) |
Creates
consumer records with the given topic name, keys, and values. |
ConsumerRecord<byte[],byte[]> |
create(java.lang.String topicName,
K key,
V value) |
Create a
ConsumerRecord with the given topic name, key, and value. |
ConsumerRecord<byte[],byte[]> |
create(java.lang.String topicName,
K key,
V value,
long timestampMs) |
Create a
ConsumerRecord with the given topic name and given topic, key, value, and timestamp. |
ConsumerRecord<byte[],byte[]> |
create(java.lang.String topicName,
K key,
V value,
Headers headers) |
Create a
ConsumerRecord with the given topic name, key, value, and headers. |
ConsumerRecord<byte[],byte[]> |
create(java.lang.String topicName,
K key,
V value,
Headers headers,
long timestampMs) |
Create a
ConsumerRecord with the given topic name, key, value, headers, and timestamp. |
ConsumerRecord<byte[],byte[]> |
create(java.lang.String topicName,
V value) |
Create a
ConsumerRecord with null -key and the given topic name and value. |
ConsumerRecord<byte[],byte[]> |
create(java.lang.String topicName,
V value,
long timestampMs) |
Create a
ConsumerRecord with null -key and the given topic name, value, and timestamp. |
ConsumerRecord<byte[],byte[]> |
create(java.lang.String topicName,
V value,
Headers headers) |
Create a
ConsumerRecord with null -key and the given topic name, value, and headers. |
ConsumerRecord<byte[],byte[]> |
create(java.lang.String topicName,
V value,
Headers headers,
long timestampMs) |
Create a
ConsumerRecord with null -key and the given topic name, value, headers, and timestamp. |
java.util.List<ConsumerRecord<byte[],byte[]>> |
create(java.util.List<KeyValue<K,V>> keyValues) |
Creates
consumer records with default topic name as well as given keys and values. |
java.util.List<ConsumerRecord<byte[],byte[]>> |
create(java.util.List<KeyValue<K,V>> keyValues,
long startTimestamp) |
Creates
consumer records with the given keys and values. |
java.util.List<ConsumerRecord<byte[],byte[]>> |
create(java.util.List<KeyValue<K,V>> keyValues,
long startTimestamp,
long advanceMs) |
Creates
consumer records with default topic name as well as given keys and values. |
ConsumerRecord<byte[],byte[]> |
create(K key,
V value) |
Create a
ConsumerRecord with default topic name and given key and value. |
ConsumerRecord<byte[],byte[]> |
create(K key,
V value,
long timestampMs) |
Create a
ConsumerRecord with default topic name and given key, value, and timestamp. |
ConsumerRecord<byte[],byte[]> |
create(K key,
V value,
Headers headers) |
Create a
ConsumerRecord with default topic name and given key, value, and headers. |
ConsumerRecord<byte[],byte[]> |
create(K key,
V value,
Headers headers,
long timestampMs) |
Create a
ConsumerRecord with default topic name and given key, value, headers, and timestamp. |
ConsumerRecord<byte[],byte[]> |
create(V value) |
Create a
ConsumerRecord with default topic name and null -key was well as given value. |
ConsumerRecord<byte[],byte[]> |
create(V value,
long timestampMs) |
Create a
ConsumerRecord with default topic name and null -key as well as given value and timestamp. |
ConsumerRecord<byte[],byte[]> |
create(V value,
Headers headers) |
Create a
ConsumerRecord with default topic name and null -key was well as given value and headers. |
ConsumerRecord<byte[],byte[]> |
create(V value,
Headers headers,
long timestampMs) |
Create a
ConsumerRecord with default topic name and null -key as well as given value, headers, and timestamp. |
public ConsumerRecordFactory(Serializer<K> keySerializer, Serializer<V> valueSerializer)
keySerializer
- the key serializervalueSerializer
- the value serializerpublic ConsumerRecordFactory(java.lang.String defaultTopicName, Serializer<K> keySerializer, Serializer<V> valueSerializer)
defaultTopicName
- the default topic name used for all generated consumer records
keySerializer
- the key serializervalueSerializer
- the value serializerpublic ConsumerRecordFactory(Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs)
keySerializer
- the key serializervalueSerializer
- the value serializerstartTimestampMs
- the initial timestamp for generated recordspublic ConsumerRecordFactory(java.lang.String defaultTopicName, Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs)
defaultTopicName
- the topic name used for all generated consumer records
keySerializer
- the key serializervalueSerializer
- the value serializerstartTimestampMs
- the initial timestamp for generated recordspublic ConsumerRecordFactory(Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs, long autoAdvanceMs)
keySerializer
- the key serializervalueSerializer
- the value serializerstartTimestampMs
- the initial timestamp for generated recordsautoAdvanceMs
- the time increment pre generated recordpublic ConsumerRecordFactory(java.lang.String defaultTopicName, Serializer<K> keySerializer, Serializer<V> valueSerializer, long startTimestampMs, long autoAdvanceMs)
defaultTopicName
- the topic name used for all generated consumer records
keySerializer
- the key serializervalueSerializer
- the value serializerstartTimestampMs
- the initial timestamp for generated recordsautoAdvanceMs
- the time increment pre generated recordpublic void advanceTimeMs(long advanceMs)
advanceMs
- the amount of time to advancepublic ConsumerRecord<byte[],byte[]> create(java.lang.String topicName, K key, V value, Headers headers, long timestampMs)
ConsumerRecord
with the given topic name, key, value, headers, and timestamp.
Does not auto advance internally tracked time.topicName
- the topic namekey
- the record keyvalue
- the record valueheaders
- the record headerstimestampMs
- the record timestampConsumerRecord
public ConsumerRecord<byte[],byte[]> create(java.lang.String topicName, K key, V value, long timestampMs)
ConsumerRecord
with the given topic name and given topic, key, value, and timestamp.
Does not auto advance internally tracked time.topicName
- the topic namekey
- the record keyvalue
- the record valuetimestampMs
- the record timestampConsumerRecord
public ConsumerRecord<byte[],byte[]> create(K key, V value, long timestampMs)
ConsumerRecord
with default topic name and given key, value, and timestamp.
Does not auto advance internally tracked time.key
- the record keyvalue
- the record valuetimestampMs
- the record timestampConsumerRecord
public ConsumerRecord<byte[],byte[]> create(K key, V value, Headers headers, long timestampMs)
ConsumerRecord
with default topic name and given key, value, headers, and timestamp.
Does not auto advance internally tracked time.key
- the record keyvalue
- the record valueheaders
- the record headerstimestampMs
- the record timestampConsumerRecord
public ConsumerRecord<byte[],byte[]> create(java.lang.String topicName, K key, V value)
ConsumerRecord
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.topicName
- the topic namekey
- the record keyvalue
- the record valueConsumerRecord
public ConsumerRecord<byte[],byte[]> create(java.lang.String topicName, K key, V value, Headers headers)
ConsumerRecord
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.topicName
- the topic namekey
- the record keyvalue
- the record valueheaders
- the record headersConsumerRecord
public ConsumerRecord<byte[],byte[]> create(K key, V value)
ConsumerRecord
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.key
- the record keyvalue
- the record valueConsumerRecord
public ConsumerRecord<byte[],byte[]> create(K key, V value, Headers headers)
ConsumerRecord
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.key
- the record keyvalue
- the record valueheaders
- the record headersConsumerRecord
public ConsumerRecord<byte[],byte[]> create(java.lang.String topicName, V value, long timestampMs)
ConsumerRecord
with null
-key and the given topic name, value, and timestamp.
Does not auto advance internally tracked time.topicName
- the topic namevalue
- the record valuetimestampMs
- the record timestampConsumerRecord
public ConsumerRecord<byte[],byte[]> create(java.lang.String topicName, V value, Headers headers, long timestampMs)
ConsumerRecord
with null
-key and the given topic name, value, headers, and timestamp.
Does not auto advance internally tracked time.topicName
- the topic namevalue
- the record valueheaders
- the record headerstimestampMs
- the record timestampConsumerRecord
public ConsumerRecord<byte[],byte[]> create(V value, long timestampMs)
ConsumerRecord
with default topic name and null
-key as well as given value and timestamp.
Does not auto advance internally tracked time.value
- the record valuetimestampMs
- the record timestampConsumerRecord
public ConsumerRecord<byte[],byte[]> create(V value, Headers headers, long timestampMs)
ConsumerRecord
with default topic name and null
-key as well as given value, headers, and timestamp.
Does not auto advance internally tracked time.value
- the record valueheaders
- the record headerstimestampMs
- the record timestampConsumerRecord
public ConsumerRecord<byte[],byte[]> create(java.lang.String topicName, V value, Headers headers)
ConsumerRecord
with null
-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.topicName
- the topic namevalue
- the record valueheaders
- the record headersConsumerRecord
public ConsumerRecord<byte[],byte[]> create(java.lang.String topicName, V value)
ConsumerRecord
with null
-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.topicName
- the topic namevalue
- the record valueConsumerRecord
public ConsumerRecord<byte[],byte[]> create(V value)
ConsumerRecord
with default topic name and null
-key was well as given value.
The timestamp will be generated based on the constructor provided start time and time will auto advance.value
- the record valueConsumerRecord
public ConsumerRecord<byte[],byte[]> create(V value, Headers headers)
ConsumerRecord
with default topic name and null
-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.value
- the record valueheaders
- the record headersConsumerRecord
public java.util.List<ConsumerRecord<byte[],byte[]>> create(java.lang.String topicName, java.util.List<KeyValue<K,V>> keyValues)
consumer 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.topicName
- the topic namekeyValues
- the record keys and valuesconsumer records
public java.util.List<ConsumerRecord<byte[],byte[]>> create(java.util.List<KeyValue<K,V>> keyValues)
consumer 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.keyValues
- the record keys and valuesconsumer records
public java.util.List<ConsumerRecord<byte[],byte[]>> create(java.lang.String topicName, java.util.List<KeyValue<K,V>> keyValues, long startTimestamp, long advanceMs)
consumer records
with the given topic name, keys, and values.
Does not auto advance internally tracked time.topicName
- the topic namekeyValues
- the record keys and valuesstartTimestamp
- the timestamp for the first generated recordadvanceMs
- the time difference between two consecutive generated recordsconsumer records
public java.util.List<ConsumerRecord<byte[],byte[]>> create(java.util.List<KeyValue<K,V>> keyValues, long startTimestamp, long advanceMs)
consumer records
with default topic name as well as given keys and values.
Does not auto advance internally tracked time.keyValues
- the record keys and valuesstartTimestamp
- the timestamp for the first generated recordadvanceMs
- the time difference between two consecutive generated recordsconsumer records
public java.util.List<ConsumerRecord<byte[],byte[]>> create(java.lang.String topicName, java.util.List<KeyValue<K,V>> keyValues, long startTimestamp)
consumer 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.topicName
- the topic namekeyValues
- the record keys and valuesstartTimestamp
- the timestamp for the first generated recordconsumer records
public java.util.List<ConsumerRecord<byte[],byte[]>> create(java.util.List<KeyValue<K,V>> keyValues, long startTimestamp)
consumer records
with the given keys and values.
For each generated record, the time is advanced by 1.
Does not auto advance internally tracked time.keyValues
- the record keys and valuesstartTimestamp
- the timestamp for the first generated recordconsumer records