From: Kai Moritz Date: Thu, 14 Nov 2024 20:21:58 +0000 (+0100) Subject: Code an die aktualisierten Versionen von Java und Spring Kafka angepasst X-Git-Tag: spring/spring-consumer--kafkalistener--BRANCH-ENDE X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=e5cb7c8bdc55f9aa14545e48d76d62c2a8b06ada;p=demos%2Fkafka%2Ftraining Code an die aktualisierten Versionen von Java und Spring Kafka angepasst --- diff --git a/src/main/java/de/juplo/kafka/ApplicationProperties.java b/src/main/java/de/juplo/kafka/ApplicationProperties.java index b8caf5c..22c755e 100644 --- a/src/main/java/de/juplo/kafka/ApplicationProperties.java +++ b/src/main/java/de/juplo/kafka/ApplicationProperties.java @@ -1,13 +1,12 @@ package de.juplo.kafka; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - @ConfigurationProperties(prefix = "juplo") @Validated diff --git a/src/main/java/de/juplo/kafka/ExampleConsumer.java b/src/main/java/de/juplo/kafka/ExampleConsumer.java index 4aa417b..f669452 100644 --- a/src/main/java/de/juplo/kafka/ExampleConsumer.java +++ b/src/main/java/de/juplo/kafka/ExampleConsumer.java @@ -21,11 +21,11 @@ public class ExampleConsumer private void handleRecord( @Header(KafkaHeaders.RECEIVED_TOPIC) String topic, - @Header(KafkaHeaders.RECEIVED_PARTITION_ID) + @Header(KafkaHeaders.RECEIVED_PARTITION) Integer partition, @Header(KafkaHeaders.OFFSET) Long offset, - @Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) + @Header(KafkaHeaders.RECEIVED_KEY) String key, @Payload String value)