Skip to content

Commit a525394

Browse files
committed
GH-407: Clarify @KafkaListener Type Inference
Resolves #407 Add note to documentation.
1 parent 48ab189 commit a525394

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/reference/asciidoc/kafka.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,12 @@ public void jsonListener(Foo foo) {
729729

730730
When using a `@KafkaListener`, the parameter type is provided to the message converter to assist with the conversion.
731731

732+
[NOTE]
733+
====
734+
This type inference can only be achieved when the `@KafkaListener` annotation is declared at the method level.
735+
With a class-level `@KafkaListener`, the payload type is used to select which `@KafkaHandler` method to invoke so it must already have been converted before the method can be chosen.
736+
====
737+
732738
NOTE: When using the `StringJsonMessageConverter`, you should use a `StringDeserializer` in the kafka consumer configuration and `StringSerializer` in the kafka producer configuration, when using Spring Integration or the `KafkaTemplate.send(Message<?> message)` method.
733739

734740
==== Log Compaction

0 commit comments

Comments
 (0)