From 930b41263f2798cf123642a064fcea95975d5e0e Mon Sep 17 00:00:00 2001 From: Borahm Lee Date: Sat, 10 Aug 2024 02:50:51 +0900 Subject: [PATCH] Fix typos in the `EnableKafka` and `tips.adoc` (#3412) --- .../src/main/antora/modules/ROOT/pages/tips.adoc | 4 ++-- .../springframework/kafka/annotation/EnableKafka.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/tips.adoc b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/tips.adoc index 0dbb13b4bf..8eebb2129b 100644 --- a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/tips.adoc +++ b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/tips.adoc @@ -12,9 +12,9 @@ The following is an example of how to use the power of a SpEL expression to crea [source, java] ---- @KafkaListener(topicPartitions = @TopicPartition(topic = "compacted", - partitions = "#{@finder.partitions('compacted')}"), + partitions = "#{@finder.partitions('compacted')}", partitionOffsets = @PartitionOffset(partition = "*", initialOffset = "0"))) -public void listen(@Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) String key, String payload) { +public void listen(@Header(KafkaHeaders.RECEIVED_KEY) String key, String payload) { ... } diff --git a/spring-kafka/src/main/java/org/springframework/kafka/annotation/EnableKafka.java b/spring-kafka/src/main/java/org/springframework/kafka/annotation/EnableKafka.java index a163bc25a0..437284b638 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/annotation/EnableKafka.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/annotation/EnableKafka.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ /** * Enable Kafka listener annotated endpoints that are created under the covers by a * {@link org.springframework.kafka.config.AbstractKafkaListenerContainerFactory - * AbstractListenerContainerFactory}. To be used on + * AbstractKafkaListenerContainerFactory}. To be used on * {@link org.springframework.context.annotation.Configuration Configuration} classes as * follows: * @@ -117,7 +117,7 @@ * *
  * @KafkaListener(containerFactory = "myKafkaListenerContainerFactory", topics = "myTopic")
- * public void process(String msg, @Header("kafka_partition") int partition) {
+ * public void process(String msg, @Header(KafkaHeaders.RECEIVED_PARTITION) int partition) {
  * 	// process incoming message
  * }
  * 
@@ -174,7 +174,7 @@ * @Override * public void configureKafkaListeners(KafkaListenerEndpointRegistrar registrar) { * registrar.setEndpointRegistry(myKafkaListenerEndpointRegistry()); - * registrar.setMessageHandlerMethodFactory(myMessageHandlerMethodFactory); + * registrar.setMessageHandlerMethodFactory(myMessageHandlerMethodFactory()); * registrar.setValidator(new MyValidator()); * } * @@ -233,6 +233,7 @@ * @author Stephane Nicoll * @author Gary Russell * @author Artem Bilan + * @author Borahm Lee * * @see KafkaListener * @see KafkaListenerAnnotationBeanPostProcessor