Skip to content

Commit

Permalink
[Doc] Add doc for init sub config in DLQ policy and producer (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertIndie authored Feb 14, 2022
1 parent 7ab2987 commit 6d79fcc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions site2/docs/client-libraries-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ Name| Type | <div style="width:300px">Description</div>| Default
`batchingEnabled`| boolean|Enable batching of messages. |true
`chunkingEnabled` | boolean | Enable chunking of messages. |false
`compressionType`|CompressionType|Message data compression type used by a producer. <br />Available options:<li>[`LZ4`](https://github.com/lz4/lz4)</li><li>[`ZLIB`](https://zlib.net/)<br /><li>[`ZSTD`](https://facebook.github.io/zstd/)</li><li>[`SNAPPY`](https://google.github.io/snappy/)</li>| No compression
`initialSubscriptionName`|string|Use this configuration to automatically create an initial subscription when creating a topic. If this field is not set, the initial subscription is not created.|null
You can configure parameters if you do not want to use the default configuration.
Expand Down
16 changes: 16 additions & 0 deletions site2/docs/concepts-messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,22 @@ Consumer<byte[]> consumer = pulsarClient.newConsumer(Schema.BYTES)
```
By default, there is no subscription during a DLQ topic creation. Without a just-in-time subscription to the DLQ topic, you may lose messages. To automatically create an initial subscription for the DLQ, you can specify the `initialSubscriptionName` parameter.
```java
Consumer<byte[]> consumer = pulsarClient.newConsumer(Schema.BYTES)
.topic(topic)
.subscriptionName("my-subscription")
.subscriptionType(SubscriptionType.Shared)
.deadLetterPolicy(DeadLetterPolicy.builder()
.maxRedeliverCount(maxRedeliveryCount)
.deadLetterTopic("your-topic-name")
.initialSubscriptionName("init-sub")
.build())
.subscribe();
```
Dead letter topic depends on message redelivery. Messages are redelivered either due to [acknowledgement timeout](#acknowledgement-timeout) or [negative acknowledgement](#negative-acknowledgement). If you are going to use negative acknowledgement on a message, make sure it is negatively acknowledged before the acknowledgement timeout.
> **Note**
Expand Down

0 comments on commit 6d79fcc

Please sign in to comment.