Skip to content

Commit

Permalink
[Doc] add custom properties for the reconsumeLater (apache#13468)
Browse files Browse the repository at this point in the history
* [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]>
  • Loading branch information
liudezhi2098 and Anonymitaet authored Dec 30, 2021
1 parent 040066f commit 33c9dea
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion site2/docs/concepts-messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 33c9dea

Please sign in to comment.