This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-reactive.git
The following commit(s) were added to refs/heads/main by this push:
new 2a3f8ec Add ReactiveMessageSenderBuilder::property (#41)
2a3f8ec is described below
commit 2a3f8ec3ce984729c8960268889a1fa147afbafb
Author: Christophe Bornet <[email protected]>
AuthorDate: Mon Nov 28 11:47:41 2022 +0100
Add ReactiveMessageSenderBuilder::property (#41)
---
.../client/api/ReactiveMessageConsumerBuilder.java | 2 +-
.../client/api/ReactiveMessageSenderBuilder.java | 23 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git
a/pulsar-client-reactive-api/src/main/java/org/apache/pulsar/reactive/client/api/ReactiveMessageConsumerBuilder.java
b/pulsar-client-reactive-api/src/main/java/org/apache/pulsar/reactive/client/api/ReactiveMessageConsumerBuilder.java
index cbc0d26..8a699a2 100644
---
a/pulsar-client-reactive-api/src/main/java/org/apache/pulsar/reactive/client/api/ReactiveMessageConsumerBuilder.java
+++
b/pulsar-client-reactive-api/src/main/java/org/apache/pulsar/reactive/client/api/ReactiveMessageConsumerBuilder.java
@@ -321,7 +321,7 @@ public interface ReactiveMessageConsumerBuilder<T> {
}
/**
- * Add a property to the consumer.
+ * Adds a property to the consumer.
*
* <p>
* Properties are application defined metadata that can be attached to
the consumer.
diff --git
a/pulsar-client-reactive-api/src/main/java/org/apache/pulsar/reactive/client/api/ReactiveMessageSenderBuilder.java
b/pulsar-client-reactive-api/src/main/java/org/apache/pulsar/reactive/client/api/ReactiveMessageSenderBuilder.java
index c620a53..9505120 100644
---
a/pulsar-client-reactive-api/src/main/java/org/apache/pulsar/reactive/client/api/ReactiveMessageSenderBuilder.java
+++
b/pulsar-client-reactive-api/src/main/java/org/apache/pulsar/reactive/client/api/ReactiveMessageSenderBuilder.java
@@ -17,6 +17,7 @@
package org.apache.pulsar.reactive.client.api;
import java.time.Duration;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
@@ -27,6 +28,7 @@ import org.apache.pulsar.client.api.HashingScheme;
import org.apache.pulsar.client.api.MessageRouter;
import org.apache.pulsar.client.api.MessageRoutingMode;
import org.apache.pulsar.client.api.ProducerAccessMode;
+import org.apache.pulsar.client.api.ProducerBuilder;
import org.apache.pulsar.client.api.ProducerCryptoFailureAction;
import org.reactivestreams.Publisher;
@@ -565,6 +567,27 @@ public interface ReactiveMessageSenderBuilder<T> {
return this;
}
+ /**
+ * Adds a property to the producer. This setting applies to each
producer created
+ * under this sender.
+ *
+ * <p>
+ * Properties are application defined metadata that can be attached to
the sender.
+ * When getting the topic stats, this metadata will be associated to
the sender stats
+ * for easier identification.
+ * @param key the key of the property to add
+ * @param value the value of the property to add
+ * @return the producer builder instance
+ * @see ProducerBuilder#property(String, String)
+ */
+ default ReactiveMessageSenderBuilder<T> property(String key, String
value) {
+ if (getMutableSpec().getProperties() == null) {
+ getMutableSpec().setProperties(new LinkedHashMap<>());
+ }
+ getMutableSpec().getProperties().put(key, value);
+ return this;
+ }
+
/**
* Sets the properties to the producer. This setting applies to each
producer created
* under this sender.