Class ConsumerRecordFactory<K,​V>

  • Type Parameters:
    K - the type of the key
    V - the type of the value

    @Deprecated
    public class ConsumerRecordFactory<K,​V>
    extends java.lang.Object
    Deprecated.
    Since 2.4 use methods of TestInputTopic instead
    Factory to create consumer records for a single single-partitioned topic with given key and value serializers.
    See Also:
    TopologyTestDriver
    • Constructor Summary

      Constructors 
      Constructor Description
      ConsumerRecordFactory​(java.lang.String defaultTopicName, org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
      Deprecated.
      Create a new factory for the given topic.
      ConsumerRecordFactory​(java.lang.String defaultTopicName, org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer, long startTimestampMs)
      Deprecated.
      Create a new factory for the given topic.
      ConsumerRecordFactory​(java.lang.String defaultTopicName, org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer, long startTimestampMs, long autoAdvanceMs)
      Deprecated.
      Create a new factory for the given topic.
      ConsumerRecordFactory​(org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
      Deprecated.
      Create a new factory for the given topic.
      ConsumerRecordFactory​(org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valueSerializer, long startTimestampMs)
      Deprecated.
      Create a new factory for the given topic.
      ConsumerRecordFactory​(org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.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.
      java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.lang.String topicName, java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues)
      Deprecated.
      Creates consumer records with the given topic name, keys, and values.
      java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.lang.String topicName, java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues, long startTimestamp)
      Deprecated.
      Creates consumer records with the given topic name, keys and values.
      java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.lang.String topicName, java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues, long startTimestamp, long advanceMs)
      Deprecated.
      Creates consumer records with the given topic name, keys, and values.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName, K key, V value)
      Deprecated.
      Create a ConsumerRecord with the given topic name, key, and value.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName, K key, V value, long timestampMs)
      Deprecated.
      Create a ConsumerRecord with the given topic name and given topic, key, value, and timestamp.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName, K key, V value, org.apache.kafka.common.header.Headers headers)
      Deprecated.
      Create a ConsumerRecord with the given topic name, key, value, and headers.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName, K key, V value, org.apache.kafka.common.header.Headers headers, long timestampMs)
      Deprecated.
      Create a ConsumerRecord with the given topic name, key, value, headers, and timestamp.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName, V value)
      Deprecated.
      Create a ConsumerRecord with null-key and the given topic name and value.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName, V value, long timestampMs)
      Deprecated.
      Create a ConsumerRecord with null-key and the given topic name, value, and timestamp.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName, V value, org.apache.kafka.common.header.Headers headers)
      Deprecated.
      Create a ConsumerRecord with null-key and the given topic name, value, and headers.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName, V value, org.apache.kafka.common.header.Headers headers, long timestampMs)
      Deprecated.
      Create a ConsumerRecord with null-key and the given topic name, value, headers, and timestamp.
      java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues)
      Deprecated.
      Creates consumer records with default topic name as well as given keys and values.
      java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues, long startTimestamp)
      Deprecated.
      Creates consumer records with the given keys and values.
      java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues, long startTimestamp, long advanceMs)
      Deprecated.
      Creates consumer records with default topic name as well as given keys and values.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(K key, V value)
      Deprecated.
      Create a ConsumerRecord with default topic name and given key and value.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(K key, V value, long timestampMs)
      Deprecated.
      Create a ConsumerRecord with default topic name and given key, value, and timestamp.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(K key, V value, org.apache.kafka.common.header.Headers headers)
      Deprecated.
      Create a ConsumerRecord with default topic name and given key, value, and headers.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(K key, V value, org.apache.kafka.common.header.Headers headers, long timestampMs)
      Deprecated.
      Create a ConsumerRecord with default topic name and given key, value, headers, and timestamp.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(V value)
      Deprecated.
      Create a ConsumerRecord with default topic name and null-key was well as given value.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(V value, long timestampMs)
      Deprecated.
      Create a ConsumerRecord with default topic name and null-key as well as given value and timestamp.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(V value, org.apache.kafka.common.header.Headers headers)
      Deprecated.
      Create a ConsumerRecord with default topic name and null-key was well as given value and headers.
      org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(V value, org.apache.kafka.common.header.Headers headers, long timestampMs)
      Deprecated.
      Create a ConsumerRecord with default topic name and null-key as well as given value, headers, and timestamp.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConsumerRecordFactory

        public ConsumerRecordFactory​(org.apache.kafka.common.serialization.Serializer<K> keySerializer,
                                     org.apache.kafka.common.serialization.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 serializer
        valueSerializer - the value serializer
      • ConsumerRecordFactory

        public ConsumerRecordFactory​(java.lang.String defaultTopicName,
                                     org.apache.kafka.common.serialization.Serializer<K> keySerializer,
                                     org.apache.kafka.common.serialization.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 generated consumer records
        keySerializer - the key serializer
        valueSerializer - the value serializer
      • ConsumerRecordFactory

        public ConsumerRecordFactory​(org.apache.kafka.common.serialization.Serializer<K> keySerializer,
                                     org.apache.kafka.common.serialization.Serializer<V> valueSerializer,
                                     long startTimestampMs)
        Deprecated.
        Create a new factory for the given topic. Auto-advance is disabled.
        Parameters:
        keySerializer - the key serializer
        valueSerializer - the value serializer
        startTimestampMs - the initial timestamp for generated records
      • ConsumerRecordFactory

        public ConsumerRecordFactory​(java.lang.String defaultTopicName,
                                     org.apache.kafka.common.serialization.Serializer<K> keySerializer,
                                     org.apache.kafka.common.serialization.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 generated consumer records
        keySerializer - the key serializer
        valueSerializer - the value serializer
        startTimestampMs - the initial timestamp for generated records
      • ConsumerRecordFactory

        public ConsumerRecordFactory​(org.apache.kafka.common.serialization.Serializer<K> keySerializer,
                                     org.apache.kafka.common.serialization.Serializer<V> valueSerializer,
                                     long startTimestampMs,
                                     long autoAdvanceMs)
        Deprecated.
        Create a new factory for the given topic.
        Parameters:
        keySerializer - the key serializer
        valueSerializer - the value serializer
        startTimestampMs - the initial timestamp for generated records
        autoAdvanceMs - the time increment pre generated record
      • ConsumerRecordFactory

        public ConsumerRecordFactory​(java.lang.String defaultTopicName,
                                     org.apache.kafka.common.serialization.Serializer<K> keySerializer,
                                     org.apache.kafka.common.serialization.Serializer<V> valueSerializer,
                                     long startTimestampMs,
                                     long autoAdvanceMs)
        Deprecated.
        Create a new factory for the given topic.
        Parameters:
        defaultTopicName - the topic name used for all generated consumer records
        keySerializer - the key serializer
        valueSerializer - the value serializer
        startTimestampMs - the initial timestamp for generated records
        autoAdvanceMs - 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 org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName,
                                                                                            K key,
                                                                                            V value,
                                                                                            org.apache.kafka.common.header.Headers headers,
                                                                                            long timestampMs)
        Deprecated.
        Create a ConsumerRecord with the given topic name, key, value, headers, and timestamp. Does not auto advance internally tracked time.
        Parameters:
        topicName - the topic name
        key - the record key
        value - the record value
        headers - the record headers
        timestampMs - the record timestamp
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName,
                                                                                            K key,
                                                                                            V value,
                                                                                            long timestampMs)
        Deprecated.
        Create a ConsumerRecord with the given topic name and given topic, key, value, and timestamp. Does not auto advance internally tracked time.
        Parameters:
        topicName - the topic name
        key - the record key
        value - the record value
        timestampMs - the record timestamp
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(K key,
                                                                                            V value,
                                                                                            long timestampMs)
        Deprecated.
        Create a ConsumerRecord with default topic name and given key, value, and timestamp. Does not auto advance internally tracked time.
        Parameters:
        key - the record key
        value - the record value
        timestampMs - the record timestamp
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(K key,
                                                                                            V value,
                                                                                            org.apache.kafka.common.header.Headers headers,
                                                                                            long timestampMs)
        Deprecated.
        Create a ConsumerRecord with default topic name and given key, value, headers, and timestamp. Does not auto advance internally tracked time.
        Parameters:
        key - the record key
        value - the record value
        headers - the record headers
        timestampMs - the record timestamp
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName,
                                                                                            K key,
                                                                                            V value)
        Deprecated.
        Create a 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.
        Parameters:
        topicName - the topic name
        key - the record key
        value - the record value
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName,
                                                                                            K key,
                                                                                            V value,
                                                                                            org.apache.kafka.common.header.Headers headers)
        Deprecated.
        Create a 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.
        Parameters:
        topicName - the topic name
        key - the record key
        value - the record value
        headers - the record headers
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(K key,
                                                                                            V value)
        Deprecated.
        Create a 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.
        Parameters:
        key - the record key
        value - the record value
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(K key,
                                                                                            V value,
                                                                                            org.apache.kafka.common.header.Headers headers)
        Deprecated.
        Create a 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.
        Parameters:
        key - the record key
        value - the record value
        headers - the record headers
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName,
                                                                                            V value,
                                                                                            long timestampMs)
        Deprecated.
        Create a ConsumerRecord with null-key and the given topic name, value, and timestamp. Does not auto advance internally tracked time.
        Parameters:
        topicName - the topic name
        value - the record value
        timestampMs - the record timestamp
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName,
                                                                                            V value,
                                                                                            org.apache.kafka.common.header.Headers headers,
                                                                                            long timestampMs)
        Deprecated.
        Create a ConsumerRecord with null-key and the given topic name, value, headers, and timestamp. Does not auto advance internally tracked time.
        Parameters:
        topicName - the topic name
        value - the record value
        headers - the record headers
        timestampMs - the record timestamp
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(V value,
                                                                                            long timestampMs)
        Deprecated.
        Create a ConsumerRecord with default topic name and null-key as well as given value and timestamp. Does not auto advance internally tracked time.
        Parameters:
        value - the record value
        timestampMs - the record timestamp
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(V value,
                                                                                            org.apache.kafka.common.header.Headers headers,
                                                                                            long timestampMs)
        Deprecated.
        Create a ConsumerRecord with default topic name and null-key as well as given value, headers, and timestamp. Does not auto advance internally tracked time.
        Parameters:
        value - the record value
        headers - the record headers
        timestampMs - the record timestamp
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName,
                                                                                            V value,
                                                                                            org.apache.kafka.common.header.Headers headers)
        Deprecated.
        Create a 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.
        Parameters:
        topicName - the topic name
        value - the record value
        headers - the record headers
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(java.lang.String topicName,
                                                                                            V value)
        Deprecated.
        Create a 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.
        Parameters:
        topicName - the topic name
        value - the record value
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(V value)
        Deprecated.
        Create a 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.
        Parameters:
        value - the record value
        Returns:
        the generated ConsumerRecord
      • create

        public org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]> create​(V value,
                                                                                            org.apache.kafka.common.header.Headers headers)
        Deprecated.
        Create a 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.
        Parameters:
        value - the record value
        headers - the record headers
        Returns:
        the generated ConsumerRecord
      • create

        public java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.lang.String topicName,
                                                                                                            java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues)
        Deprecated.
        Creates 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.
        Parameters:
        topicName - the topic name
        keyValues - the record keys and values
        Returns:
        the generated consumer records
      • create

        public java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues)
        Deprecated.
        Creates 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.
        Parameters:
        keyValues - the record keys and values
        Returns:
        the generated consumer records
      • create

        public java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.lang.String topicName,
                                                                                                            java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues,
                                                                                                            long startTimestamp,
                                                                                                            long advanceMs)
        Deprecated.
        Creates consumer records with the given topic name, keys, and values. Does not auto advance internally tracked time.
        Parameters:
        topicName - the topic name
        keyValues - the record keys and values
        startTimestamp - the timestamp for the first generated record
        advanceMs - the time difference between two consecutive generated records
        Returns:
        the generated consumer records
      • create

        public java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues,
                                                                                                            long startTimestamp,
                                                                                                            long advanceMs)
        Deprecated.
        Creates consumer 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 values
        startTimestamp - the timestamp for the first generated record
        advanceMs - the time difference between two consecutive generated records
        Returns:
        the generated consumer records
      • create

        public java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.lang.String topicName,
                                                                                                            java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues,
                                                                                                            long startTimestamp)
        Deprecated.
        Creates 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.
        Parameters:
        topicName - the topic name
        keyValues - the record keys and values
        startTimestamp - the timestamp for the first generated record
        Returns:
        the generated consumer records
      • create

        public java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],​byte[]>> create​(java.util.List<org.apache.kafka.streams.KeyValue<K,​V>> keyValues,
                                                                                                            long startTimestamp)
        Deprecated.
        Creates 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.
        Parameters:
        keyValues - the record keys and values
        startTimestamp - the timestamp for the first generated record
        Returns:
        the generated consumer records