Skip to content

Commit b74618f

Browse files
authored
GH-4194: Correcting errors in the docs for Share Consumer deliver counts. (#4195)
Fixes #4194 Previous documentation referenced a configuration parameter as being exposed via the Kafka Admin API. This is NOT the case, as the `share.group.delivery.attempt.limit` is NOT a valid share group configuration. As such, it is not available via the Admin API. Also, the correct value of `share.group.delivery.count.limit` is a broker-level configuraion. This cannot be overriden at the consumer group level. Signed-off-by: Sandon Jacobs <sandon.jacobs@gmail.com>
1 parent 9c3718d commit b74618f

File tree

1 file changed

+5
-29
lines changed

1 file changed

+5
-29
lines changed

spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/kafka-queues.adoc

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -674,51 +674,27 @@ Every time a record is acquired by a consumer in a share group, the broker incre
674674
The first acquisition sets the delivery count to 1, and each subsequent acquisition increments it.
675675
When the delivery count reaches the configured limit (default: 5), the record moves to **Archived** state and is not eligible for additional delivery attempts.
676676

677-
=== Configuration
678-
679-
The maximum delivery attempts can be configured per share group using the Admin API:
680-
681-
[source,java]
682-
----
683-
private void configureMaxDeliveryAttempts(String bootstrapServers, String groupId) throws Exception {
684-
Map<String, Object> adminProps = new HashMap<>();
685-
adminProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
686-
687-
try (Admin admin = Admin.create(adminProps)) {
688-
ConfigResource configResource = new ConfigResource(ConfigResource.Type.GROUP, groupId);
689-
690-
// Default is 5, adjust based on your retry tolerance
691-
ConfigEntry maxAttempts = new ConfigEntry("group.share.delivery.attempt.limit", "10");
692-
693-
Map<ConfigResource, Collection<AlterConfigOp>> configs = Map.of(
694-
configResource, List.of(new AlterConfigOp(maxAttempts, AlterConfigOp.OpType.SET))
695-
);
696-
697-
admin.incrementalAlterConfigs(configs).all().get();
698-
}
699-
}
700-
----
701-
702677
[IMPORTANT]
703678
====
704679
**Delivery Count is Not Exposed to Applications**
705-
706680
The delivery count is maintained internally by the broker and is **not exposed to consumer applications**.
707681
This is an intentional design decision in KIP-932.
708682
The delivery count is approximate and serves as a poison message protection mechanism, not a precise redelivery counter.
709683
Applications cannot query or access this value through any API.
684+
====
710685

711686
For application-level retry logic, use the acknowledgment types:
712687

713688
* `RELEASE` - Make record available for redelivery (contributes to delivery count)
714689
* `REJECT` - Mark as permanently failed (does not cause redelivery)
715690
* `ACCEPT` - Successfully processed (does not cause redelivery)
716691

717-
The broker automatically prevents endless redelivery once `group.share.delivery.attempt.limit` is reached, moving the record to Archived state.
718-
====
692+
The broker automatically prevents endless redelivery once `group.share.delivery.count.limit` is reached, moving the record to Archived state.
719693

720694
=== Retry Strategy Recommendations
721695

696+
Here is an example of how to use the various acknowledgement types based exception types.
697+
722698
[source,java]
723699
----
724700
@KafkaListener(topics = "orders", containerFactory = "explicitShareKafkaListenerContainerFactory")
@@ -731,7 +707,7 @@ public void processOrder(ConsumerRecord<String, String> record, ShareAcknowledgm
731707
catch (TransientException e) {
732708
// Temporary failure (network issue, service unavailable, etc.)
733709
// Release the record for redelivery
734-
// Broker will retry up to group.share.delivery.attempt.limit times
710+
// Broker will retry up to group.share.delivery.count.limit times
735711
logger.warn("Transient error processing order, will retry: {}", e.getMessage());
736712
ack.release(); // RELEASE - make available for retry
737713
}

0 commit comments

Comments
 (0)