Skip to content

Commit

Permalink
GH-3617 : Value parameters in ReactiveKafkaProducerTemplate should be…
Browse files Browse the repository at this point in the history
… nullable (#3651)

Fixes: #3617

* add @nullable parameter to send method
* change package for @nullable
* fix import order checkstyle

(cherry picked from commit e27a344)
  • Loading branch information
jukekxm authored and spring-builds committed Dec 7, 2024
1 parent 22b1f2d commit 88026ed
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.kafka.support.converter.MessagingMessageConverter;
import org.springframework.kafka.support.converter.RecordMessageConverter;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.util.Assert;

Expand All @@ -51,6 +52,7 @@
*
* @author Mark Norkin
* @author Adrian Chlebosz
* @author Juhyun Kim
*
* @since 2.3.0
*/
Expand Down Expand Up @@ -92,19 +94,19 @@ public <T> Mono<SenderResult<T>> sendTransactionally(SenderRecord<K, V, T> recor
return sendTransactionally.single();
}

public Mono<SenderResult<Void>> send(String topic, V value) {
public Mono<SenderResult<Void>> send(String topic, @Nullable V value) {
return send(new ProducerRecord<>(topic, value));
}

public Mono<SenderResult<Void>> send(String topic, K key, V value) {
public Mono<SenderResult<Void>> send(String topic, K key, @Nullable V value) {
return send(new ProducerRecord<>(topic, key, value));
}

public Mono<SenderResult<Void>> send(String topic, int partition, K key, V value) {
public Mono<SenderResult<Void>> send(String topic, int partition, K key, @Nullable V value) {
return send(new ProducerRecord<>(topic, partition, key, value));
}

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

Expand Down

0 comments on commit 88026ed

Please sign in to comment.