Skip to content

Commit 03c0da3

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

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -625,12 +625,12 @@ Apache Pulsar provides various native strategies for message redelivery and erro
625625
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.
626626
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.
627627

628-
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`:
628+
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`:
629629

630630
[source, java]
631631
----
632632
@PulsarListener(subscriptionName = "subscription-1", topics = "topic-1"
633-
properties = {"ackTimeout=60s"})
633+
properties = {"ackTimeoutMillis=60000"})
634634
public void listen(String s) {
635635
...
636636
}
@@ -649,7 +649,7 @@ class AckTimeoutRedeliveryConfig {
649649
@PulsarListener(subscriptionName = "withAckTimeoutRedeliveryBackoffSubscription",
650650
topics = "withAckTimeoutRedeliveryBackoff-test-topic",
651651
ackTimeoutRedeliveryBackoff = "ackTimeoutRedeliveryBackoff",
652-
properties = { "ackTimeout=60s" })
652+
properties = { "ackTimeoutMillis=60000" })
653653
void listen(String msg) {
654654
// some long-running process that may cause an ack timeout
655655
}
@@ -720,7 +720,7 @@ class DeadLetterPolicyConfig {
720720
721721
@PulsarListener(id = "deadLetterPolicyListener", subscriptionName = "deadLetterPolicySubscription",
722722
topics = "topic-with-dlp", deadLetterPolicy = "deadLetterPolicy",
723-
subscriptionType = SubscriptionType.Shared, properties = { "ackTimeout=1s" })
723+
subscriptionType = SubscriptionType.Shared, properties = { "ackTimeoutMillis=1000" })
724724
void listen(String msg) {
725725
throw new RuntimeException("fail " + msg);
726726
}
@@ -743,7 +743,7 @@ This bean specifies a number of things, such as the max delivery (10, in this ca
743743
If you do not specify a DLQ topic name, it defaults to `<topicname>-<subscriptionname>-DLQ` in Pulsar.
744744
Next, we provide this bean name to `PulsarListener` by setting the `deadLetterPolicy` property.
745745
Note that the `PulsarListener` has a subscription type of `Shared`, as the DLQ feature only works with shared subscriptions.
746-
This code is primarily for demonstration purposes, so we provide an `ackTimeout` value of 1 second.
746+
This code is primarily for demonstration purposes, so we provide an `ackTimeoutMillis` value of 1000.
747747
The idea is that the code throws the exception and, if Pulsar does not receive an ack within 1 second, it does a retry.
748748
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.
749749
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

+4-3
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`.
@@ -293,7 +294,7 @@ You can specify this property directly as a Pulsar consumer property via a <<rea
293294
----
294295
@Bean
295296
ReactiveMessageConsumerBuilderCustomizer<String> consumerCustomizer() {
296-
return b -> b.property("ackTimeout", "60s");
297+
return b -> b.property("ackTimeoutMillis", "60000");
297298
}
298299
----
299300

@@ -342,7 +343,7 @@ class DeadLetterPolicyConfig {
342343
343344
@Bean
344345
ReactiveMessageConsumerBuilderCustomizer<String> ackTimeoutCustomizer() {
345-
return b -> b.property("ackTimeout", "1s");
346+
return b -> b.property("ackTimeoutMillis", "1000");
346347
}
347348
}
348349
----
@@ -352,7 +353,7 @@ This bean specifies a number of things, such as the max delivery (10, in this ca
352353
If you do not specify a DLQ topic name, it defaults to `<topicname>-<subscriptionname>-DLQ` in Pulsar.
353354
Next, we provide this bean name to `ReactivePulsarListener` by setting the `deadLetterPolicy` property.
354355
Note that the `ReactivePulsarListener` has a subscription type of `Shared`, as the DLQ feature only works with shared subscriptions.
355-
This code is primarily for demonstration purposes, so we provide an `ackTimeout` value of 1 second.
356+
This code is primarily for demonstration purposes, so we provide an `ackTimeoutMillis` value of 1000.
356357
The idea is that the code throws the exception and, if Pulsar does not receive an ack within 1 second, it does a retry.
357358
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.
358359
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)