From a126fe7b95dadd5f51d2a668af430778a1f5494f Mon Sep 17 00:00:00 2001 From: Artur Ciocanu Date: Thu, 25 Jul 2024 10:28:31 +0300 Subject: [PATCH] Simplify Dapr Messaging interface --- .../spring/messaging/DaprMessagingOperations.java | 9 +++------ .../dapr/spring/messaging/DaprMessagingTemplate.java | 12 ++++++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/sdk-springboot/sdk-spring-core/src/main/java/io/dapr/spring/messaging/DaprMessagingOperations.java b/sdk-springboot/sdk-spring-core/src/main/java/io/dapr/spring/messaging/DaprMessagingOperations.java index 856ee101a..ac1092c9a 100644 --- a/sdk-springboot/sdk-spring-core/src/main/java/io/dapr/spring/messaging/DaprMessagingOperations.java +++ b/sdk-springboot/sdk-spring-core/src/main/java/io/dapr/spring/messaging/DaprMessagingOperations.java @@ -23,9 +23,8 @@ public interface DaprMessagingOperations { * @param topic the topic to send the message to or {@code null} to send to the * default topic * @param message the message to send - * @return the id assigned by the broker to the published message */ - Void send(String topic, T message); + void send(String topic, T message); /** * Create a {@link SendMessageBuilder builder} for configuring and sending a message. @@ -53,15 +52,13 @@ interface SendMessageBuilder { /** * Send the message in a blocking manner using the configured specification. - * - * @return the id assigned by the broker to the published message */ - Void send(); + void send(); /** * Uses the configured specification to send the message in a non-blocking manner. * - * @return a future that holds the id assigned by the broker to the published message + * @return a Mono that completes when the message has been sent */ Mono sendAsync(); } diff --git a/sdk-springboot/sdk-spring-core/src/main/java/io/dapr/spring/messaging/DaprMessagingTemplate.java b/sdk-springboot/sdk-spring-core/src/main/java/io/dapr/spring/messaging/DaprMessagingTemplate.java index 9dd115f04..604849b86 100644 --- a/sdk-springboot/sdk-spring-core/src/main/java/io/dapr/spring/messaging/DaprMessagingTemplate.java +++ b/sdk-springboot/sdk-spring-core/src/main/java/io/dapr/spring/messaging/DaprMessagingTemplate.java @@ -32,8 +32,8 @@ public DaprMessagingTemplate(DaprClient daprClient, String pubsubName) { } @Override - public Void send(String topic, T message) { - return doSend(topic, message); + public void send(String topic, T message) { + doSend(topic, message); } @Override @@ -41,8 +41,8 @@ public SendMessageBuilder newMessage(T message) { return new SendMessageBuilderImpl<>(this, message); } - private Void doSend(String topic, T message) { - return doSendAsync(topic, message).block(); + private void doSend(String topic, T message) { + doSendAsync(topic, message).block(); } private Mono doSendAsync(String topic, T message) { @@ -73,8 +73,8 @@ public SendMessageBuilder withTopic(String topic) { @Override - public Void send() { - return this.template.doSend(this.topic, this.message); + public void send() { + this.template.doSend(this.topic, this.message); } @Override