Skip to content

Commit e27a344

Browse files
authored
GH-3617 : Value parameters in ReactiveKafkaProducerTemplate should be nullable (#3651)
Fixes: #3617 * add @nullable parameter to send method * change package for @nullable * fix import order checkstyle **Auto-cherry-pick to `3.2.x`**
1 parent eca3750 commit e27a344

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spring-kafka/src/main/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplate.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.springframework.kafka.support.KafkaHeaders;
4141
import org.springframework.kafka.support.converter.MessagingMessageConverter;
4242
import org.springframework.kafka.support.converter.RecordMessageConverter;
43+
import org.springframework.lang.Nullable;
4344
import org.springframework.messaging.Message;
4445
import org.springframework.util.Assert;
4546

@@ -51,6 +52,7 @@
5152
*
5253
* @author Mark Norkin
5354
* @author Adrian Chlebosz
55+
* @author Juhyun Kim
5456
*
5557
* @since 2.3.0
5658
*/
@@ -92,19 +94,19 @@ public <T> Mono<SenderResult<T>> sendTransactionally(SenderRecord<K, V, T> recor
9294
return sendTransactionally.single();
9395
}
9496

95-
public Mono<SenderResult<Void>> send(String topic, V value) {
97+
public Mono<SenderResult<Void>> send(String topic, @Nullable V value) {
9698
return send(new ProducerRecord<>(topic, value));
9799
}
98100

99-
public Mono<SenderResult<Void>> send(String topic, K key, V value) {
101+
public Mono<SenderResult<Void>> send(String topic, K key, @Nullable V value) {
100102
return send(new ProducerRecord<>(topic, key, value));
101103
}
102104

103-
public Mono<SenderResult<Void>> send(String topic, int partition, K key, V value) {
105+
public Mono<SenderResult<Void>> send(String topic, int partition, K key, @Nullable V value) {
104106
return send(new ProducerRecord<>(topic, partition, key, value));
105107
}
106108

107-
public Mono<SenderResult<Void>> send(String topic, int partition, long timestamp, K key, V value) {
109+
public Mono<SenderResult<Void>> send(String topic, int partition, long timestamp, K key, @Nullable V value) {
108110
return send(new ProducerRecord<>(topic, partition, timestamp, key, value));
109111
}
110112

0 commit comments

Comments
 (0)