Class OutgoingKafkaRecord<K,​T>

    • Constructor Detail

    • Method Detail

      • ack

        public CompletionStage<Void> ack()
        Description copied from interface: Message
        Acknowledge this message.
        Specified by:
        ack in interface Message<K>
        Returns:
        a completion stage completed when the message is acknowledged. If the acknowledgement fails, the completion stage propagates the failure.
      • getPayload

        public T getPayload()
        Specified by:
        getPayload in interface Message<K>
        Returns:
        The payload for this message.
      • getHeaders

        public org.apache.kafka.common.header.Headers getHeaders()
        Specified by:
        getHeaders in interface KafkaRecord<K,​T>
      • getMetadata

        public Metadata getMetadata()
        Specified by:
        getMetadata in interface Message<K>
        Returns:
        The set of metadata attached to this message, potentially empty.
      • withHeader

        public OutgoingKafkaRecord<K,​T> withHeader​(String key,
                                                         byte[] content)
        Creates a new outgoing Kafka Message with a header added to the header list.
        Parameters:
        key - the header key
        content - the header key, must not be null
        Returns:
        the updated Kafka Message.
      • withHeader

        public OutgoingKafkaRecord<K,​T> withHeader​(String key,
                                                         String content)
        Creates a new outgoing Kafka Message with a header added to the header list.
        Parameters:
        key - the header key
        content - the header key, must not be null
        Returns:
        the updated Kafka Message.
      • withHeader

        public OutgoingKafkaRecord<K,​T> withHeader​(String key,
                                                         String content,
                                                         Charset enc)
        Creates a new outgoing Kafka Message with a header added to the header list.
        Parameters:
        key - the header key
        content - the header key, must not be null
        enc - the encoding, must not be null
        Returns:
        the updated Kafka Message.
      • withPayload

        public <P> OutgoingKafkaRecord<K,​P> withPayload​(P payload)
        Description copied from interface: Message
        Creates a new instance of Message with the specified payload. The metadata and acknowledgment function are taken from the current Message.
        Specified by:
        withPayload in interface Message<K>
        Type Parameters:
        P - the type of the new payload
        Parameters:
        payload - the new payload.
        Returns:
        the new instance of Message
      • withMetadata

        public OutgoingKafkaRecord<K,​T> withMetadata​(Iterable<Object> metadata)
        Description copied from interface: Message
        Creates a new instance of Message with the specified metadata. The payload and acknowledgment function are taken from the current Message.
        Specified by:
        withMetadata in interface Message<K>
        Parameters:
        metadata - the metadata, must not be null, must not contains null.
        Returns:
        the new instance of Message
      • withMetadata

        public OutgoingKafkaRecord<K,​T> withMetadata​(Metadata metadata)
        Description copied from interface: Message
        Creates a new instance of Message with the specified metadata. The payload and acknowledgment function are taken from the current Message.
        Specified by:
        withMetadata in interface Message<K>
        Parameters:
        metadata - the metadata, must not be null.
        Returns:
        the new instance of Message