Class ConnectRecord<R extends ConnectRecord<R>>

  • Direct Known Subclasses:
    SinkRecord, SourceRecord

    public abstract class ConnectRecord<R extends ConnectRecord<R>>
    extends Object

    Base class for records containing data to be copied to/from Kafka. This corresponds closely to Kafka's ProducerRecord and ConsumerRecord classes, and holds the data that may be used by both sources and sinks (topic, kafkaPartition, key, value). Although both implementations include a notion of offset, it is not included here because they differ in type.

    • Method Detail

      • topic

        public String topic()
      • kafkaPartition

        public Integer kafkaPartition()
      • keySchema

        public Schema keySchema()
      • value

        public Object value()
      • valueSchema

        public Schema valueSchema()
      • timestamp

        public Long timestamp()
      • headers

        public Headers headers()
        Get the headers for this record.
        Returns:
        the headers; never null
      • newRecord

        public abstract R newRecord​(String topic,
                                    Integer kafkaPartition,
                                    Schema keySchema,
                                    Object key,
                                    Schema valueSchema,
                                    Object value,
                                    Long timestamp)
        Create a new record of the same type as itself, with the specified parameter values. All other fields in this record will be copied over to the new record. Since the headers are mutable, the resulting record will have a copy of this record's headers.
        Parameters:
        topic - the name of the topic; may be null
        kafkaPartition - the partition number for the Kafka topic; may be null
        keySchema - the schema for the key; may be null
        key - the key; may be null
        valueSchema - the schema for the value; may be null
        value - the value; may be null
        timestamp - the timestamp; may be null
        Returns:
        the new record
      • newRecord

        public abstract R newRecord​(String topic,
                                    Integer kafkaPartition,
                                    Schema keySchema,
                                    Object key,
                                    Schema valueSchema,
                                    Object value,
                                    Long timestamp,
                                    Iterable<Header> headers)
        Create a new record of the same type as itself, with the specified parameter values. All other fields in this record will be copied over to the new record.
        Parameters:
        topic - the name of the topic; may be null
        kafkaPartition - the partition number for the Kafka topic; may be null
        keySchema - the schema for the key; may be null
        key - the key; may be null
        valueSchema - the schema for the value; may be null
        value - the value; may be null
        timestamp - the timestamp; may be null
        headers - the headers; may be null or empty
        Returns:
        the new record
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object