This is an automated email from the ASF dual-hosted git repository.
liuyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 33c9dea [Doc] add custom properties for the reconsumeLater (#13468)
33c9dea is described below
commit 33c9dea61d73d8ec646e80eff6c649c0121062a9
Author: liudezhi <[email protected]>
AuthorDate: Thu Dec 30 12:02:24 2021 +0800
[Doc] add custom properties for the reconsumeLater (#13468)
* [Doc] add custom properties for the reconsumeLater
* Update site2/docs/concepts-messaging.md
agree
Co-authored-by: Anonymitaet <[email protected]>
* Update site2/docs/concepts-messaging.md
agree
Co-authored-by: Anonymitaet <[email protected]>
* Update site2/docs/concepts-messaging.md
agree
Co-authored-by: Anonymitaet <[email protected]>
* Update site2/docs/concepts-messaging.md
agree
Co-authored-by: Anonymitaet <[email protected]>
* provide a complete example
Co-authored-by: Anonymitaet <[email protected]>
---
site2/docs/concepts-messaging.md | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/site2/docs/concepts-messaging.md b/site2/docs/concepts-messaging.md
index 7eba63c..a533abf 100644
--- a/site2/docs/concepts-messaging.md
+++ b/site2/docs/concepts-messaging.md
@@ -273,13 +273,36 @@ Consumer<byte[]> consumer =
pulsarClient.newConsumer(Schema.BYTES)
.subscribe();
```
+Retry letter message contains some special properties created by a client
automatically.
+
+Special property | Description
+:--------------------|:-----------
+`REAL_TOPIC` | The real topic name.
+`ORIGIN_MESSAGE_ID` | The origin message ID. It is crucial for message
tracking.
+`RECONSUMETIMES` | The retry consume times.
+`DELAY_TIME` | Message delay timeMs.
+**Example**
+```
+REAL_TOPIC = persistent://public/default/my-topic
+ORIGIN_MESSAGE_ID = 1:0:-1:0
+RECONSUMETIMES = 6
+DELAY_TIME = 3000
+```
+
If you want to put messages into a retrial queue, you can use the following
API.
```java
-consumer.reconsumeLater(msg,3,TimeUnit.SECONDS);
+consumer.reconsumeLater(msg, 3, TimeUnit.SECONDS);
```
+If you want to add custom properties for the `reconsumeLater`, you can use the
following API.
+```java
+Map<String, String> customProperties = new HashMap<String, String>();
+customProperties.put("custom-key-1", "custom-value-1");
+customProperties.put("custom-key-2", "custom-value-2");
+consumer.reconsumeLater(msg, customProperties, 3, TimeUnit.SECONDS);
+```
## Topics