Skip to content

Commit

Permalink
code indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
liangyepianzhou committed Apr 2, 2024
1 parent cf30381 commit d7f55bf
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions docs/tutorials-redeliver-messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,19 @@ handle non-retryable messages in the dead letter topic.
![img_2.png](../static/img/blog-consume-best-practice/DLQ.png)
```java
Consumer<Integer> consumer = pulsarClient.newConsumer(Schema.INT32)
.deadLetterPolicy(DeadLetterPolicy.builder()
.maxRedeliverCount(maxRedeliverCount)
.deadLetterTopic(deadLetterTopic)
.retryLetterTopic(retryLetterTopic)
.initialSubscriptionName(initialSubscriptionName)
.build())
.subscriptionType(SubscriptionType.Shared)
.enableRetry(true)
.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
.topic(topic)
.subscriptionName(sub)
.subscribe();
Message<Integer> message = consumer.receive();
.deadLetterPolicy(DeadLetterPolicy.builder()
.maxRedeliverCount(maxRedeliverCount)
.deadLetterTopic(deadLetterTopic)
.retryLetterTopic(retryLetterTopic)
.initialSubscriptionName(initialSubscriptionName)
.build())
.subscriptionType(SubscriptionType.Shared)
.enableRetry(true)
.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
.topic(topic)
.subscriptionName(sub)
.subscribe();
Message<Integer> message = consumer.receive();
try{
// Process message
consumer.acknowledge(message);
Expand All @@ -143,12 +143,12 @@ it may result in duplicate message consumption.
![img_3.png](../static/img/blog-consume-best-practice/AckTimeout.png)
```java
Consumer<Integer> consumer = pulsarClient.newConsumer(Schema.INT32)
.ackTimeout(tiemout, timeunit)
.subscriptionType(SubscriptionType.Shared)
.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
.topic(topic)
.subscriptionName(sub)
.subscribe();
.ackTimeout(tiemout, timeunit)
.subscriptionType(SubscriptionType.Shared)
.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
.topic(topic)
.subscriptionName(sub)
.subscribe();
```

For case 3, there are no effective preventive measures. This is because all methods of redelivery are triggered by the
Expand Down

0 comments on commit d7f55bf

Please sign in to comment.