Skip to content

Commit 20dfbeb

Browse files
authored
Fix references to invalid 'ackTimeout' property (#1015) (#1016)
The docs has code examples using a consumer property named `ackTimeout`. However, the actual property name is `ackTimeoutMillis`. This updates those references. Resolves #1010 (cherry picked from commit 03c0da3)
1 parent 8667995 commit 20dfbeb

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

spring-pulsar-docs/src/main/antora/modules/ROOT/pages/reference/pulsar/message-consumption.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,12 @@ Apache Pulsar provides various native strategies for message redelivery and erro
631631
By default, Pulsar consumers do not redeliver messages unless the consumer crashes, but you can change this behavior by setting an ack timeout on the Pulsar consumer.
632632
If the ack timeout property has a value above zero and if the Pulsar consumer does not acknowledge a message within that timeout period, the message is redelivered.
633633

634-
When you use Spring for Apache Pulsar, you can set this property via a <<_consumer_customization_on_pulsarlistener,consumer customizer>> or with the native Pulsar `ackTimeout` property in the `properties` attribute of `@PulsarListener`:
634+
When you use Spring for Apache Pulsar, you can set this property via a <<_consumer_customization_on_pulsarlistener,consumer customizer>> or with the native Pulsar `ackTimeoutMillis` property in the `properties` attribute of `@PulsarListener`:
635635

636636
[source, java]
637637
----
638638
@PulsarListener(subscriptionName = "subscription-1", topics = "topic-1"
639-
properties = {"ackTimeout=60s"})
639+
properties = {"ackTimeoutMillis=60000"})
640640
public void listen(String s) {
641641
...
642642
}
@@ -655,7 +655,7 @@ class AckTimeoutRedeliveryConfig {
655655
@PulsarListener(subscriptionName = "withAckTimeoutRedeliveryBackoffSubscription",
656656
topics = "withAckTimeoutRedeliveryBackoff-test-topic",
657657
ackTimeoutRedeliveryBackoff = "ackTimeoutRedeliveryBackoff",
658-
properties = { "ackTimeout=60s" })
658+
properties = { "ackTimeoutMillis=60000" })
659659
void listen(String msg) {
660660
// some long-running process that may cause an ack timeout
661661
}
@@ -726,7 +726,7 @@ class DeadLetterPolicyConfig {
726726
727727
@PulsarListener(id = "deadLetterPolicyListener", subscriptionName = "deadLetterPolicySubscription",
728728
topics = "topic-with-dlp", deadLetterPolicy = "deadLetterPolicy",
729-
subscriptionType = SubscriptionType.Shared, properties = { "ackTimeout=1s" })
729+
subscriptionType = SubscriptionType.Shared, properties = { "ackTimeoutMillis=1000" })
730730
void listen(String msg) {
731731
throw new RuntimeException("fail " + msg);
732732
}
@@ -749,7 +749,7 @@ This bean specifies a number of things, such as the max delivery (10, in this ca
749749
If you do not specify a DLQ topic name, it defaults to `<topicname>-<subscriptionname>-DLQ` in Pulsar.
750750
Next, we provide this bean name to `PulsarListener` by setting the `deadLetterPolicy` property.
751751
Note that the `PulsarListener` has a subscription type of `Shared`, as the DLQ feature only works with shared subscriptions.
752-
This code is primarily for demonstration purposes, so we provide an `ackTimeout` value of 1 second.
752+
This code is primarily for demonstration purposes, so we provide an `ackTimeoutMillis` value of 1000.
753753
The idea is that the code throws the exception and, if Pulsar does not receive an ack within 1 second, it does a retry.
754754
If that cycle continues ten times (as that is our max redelivery count in the `DeadLetterPolicy`), the Pulsar consumer publishes the messages to the DLQ topic.
755755
We have another `PulsarListener` that listens on the DLQ topic to receive data as it is published to the DLQ topic.

spring-pulsar-docs/src/main/antora/modules/ROOT/pages/reference/reactive-pulsar/reactive-message-consumption.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Flux<MessageResult<Void>> listen(Flux<org.apache.pulsar.client.api.Message<Strin
8888
return messages
8989
.doOnNext((msg) -> System.out.println("Received: " + msg.getValue()))
9090
.map(MessageResult::acknowledge);
91+
}
9192
----
9293
Here we receive the records as a `Flux` of Pulsar messages.
9394
In addition, to enable stream consumption at the `ReactivePulsarListener` level, you need to set the `stream` property on the annotation to `true`.
@@ -294,7 +295,7 @@ You can specify this property directly as a Pulsar consumer property via a <<rea
294295
----
295296
@Bean
296297
ReactiveMessageConsumerBuilderCustomizer<String> consumerCustomizer() {
297-
return b -> b.property("ackTimeout", "60s");
298+
return b -> b.property("ackTimeoutMillis", "60000");
298299
}
299300
----
300301

@@ -343,7 +344,7 @@ class DeadLetterPolicyConfig {
343344
344345
@Bean
345346
ReactiveMessageConsumerBuilderCustomizer<String> ackTimeoutCustomizer() {
346-
return b -> b.property("ackTimeout", "1s");
347+
return b -> b.property("ackTimeoutMillis", "1000");
347348
}
348349
}
349350
----
@@ -353,7 +354,7 @@ This bean specifies a number of things, such as the max delivery (10, in this ca
353354
If you do not specify a DLQ topic name, it defaults to `<topicname>-<subscriptionname>-DLQ` in Pulsar.
354355
Next, we provide this bean name to `ReactivePulsarListener` by setting the `deadLetterPolicy` property.
355356
Note that the `ReactivePulsarListener` has a subscription type of `Shared`, as the DLQ feature only works with shared subscriptions.
356-
This code is primarily for demonstration purposes, so we provide an `ackTimeout` value of 1 second.
357+
This code is primarily for demonstration purposes, so we provide an `ackTimeoutMillis` value of 1000.
357358
The idea is that the code throws the exception and, if Pulsar does not receive an ack within 1 second, it does a retry.
358359
If that cycle continues ten times (as that is our max redelivery count in the `DeadLetterPolicy`), the Pulsar consumer publishes the messages to the DLQ topic.
359360
We have another `ReactivePulsarListener` that listens on the DLQ topic to receive data as it is published to the DLQ topic.

0 commit comments

Comments
 (0)