diff --git a/site2/docs/client-libraries-java.md b/site2/docs/client-libraries-java.md index 9c725354acff8..fe65d9028460a 100644 --- a/site2/docs/client-libraries-java.md +++ b/site2/docs/client-libraries-java.md @@ -208,6 +208,7 @@ Name| Type |
Description
| Default `batchingMaxMessages` |int|The maximum number of messages permitted in a batch.|1000 `batchingEnabled`| boolean|Enable batching of messages. |true `compressionType`|CompressionType|Message data compression type used by a producer.
Available options:
  • [`LZ4`](https://github.com/lz4/lz4)
  • [`ZLIB`](https://zlib.net/)
  • [`ZSTD`](https://facebook.github.io/zstd/)
  • [`SNAPPY`](https://google.github.io/snappy/)
  • | 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. diff --git a/site2/docs/concepts-messaging.md b/site2/docs/concepts-messaging.md index bd9d23c892fd6..32626df8ddb01 100644 --- a/site2/docs/concepts-messaging.md +++ b/site2/docs/concepts-messaging.md @@ -302,6 +302,22 @@ Consumer 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 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**