Skip to content

Commit

Permalink
Document @KafkaPartition and @KafkaPartitionKey annotations (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
André Prata authored Jul 19, 2021
1 parent 66f4010 commit 8ca9ae2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/main/docs/guide/kafkaClient/kafkaClientMethods.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ The following table summarizes the annotations and their purpose, with an exampl
| Allows specifying the parameter that is the Kafka key
|`@KafkaKey String key`

|ann:configuration.kafka.annotation.KafkaPartition[]
| Allows specifying the parameter that is the partition number
|`@KafkaPartition Integer partition`

|ann:configuration.kafka.annotation.KafkaPartitionKey[]
| Allows specifying the parameter that is used to compute a partition number independently from the Message Key.
|`@KafkaPartition String partitionKey`

|===

For example, you can use the https://docs.micronaut.io/latest/api/io/micronaut/messaging/annotation/Header.html[@Header] annotation to bind a parameter value to a header in the `ProducerRecord`.
8 changes: 6 additions & 2 deletions src/main/docs/guide/kafkaListener/kafkaListenerMethods.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ The following table summarizes the annotations and their purpose, with an exampl
|`@Header("X-My-Header") String myHeader`

|ann:configuration.kafka.annotation.KafkaKey[]
| Allows specifying the parameter that is the key
|`@KafkaKey String key`
| Allows binding a parameter to the message key
|`@KafkaKey String messageKey`

|ann:configuration.kafka.annotation.KafkaPartition[]
| Allows binding a parameter to the partition the message was received from
|`@KafkaPartition Integer partition`

|===

Expand Down

0 comments on commit 8ca9ae2

Please sign in to comment.