Skip to content

Partial positive acknowledge support for BatchAcknowledgingMessageListener #2066

@bgK

Description

@bgK

Affects Version(s): 2.8.1

When consuming records using a batch listener, I would like to be able to commit the offsets for records up to a specific index in the batch, and then keep processing the batch until all the records are processed, without having to yield control back to the container.

In our case, some of the records can be handled together when they are consecutive, for improved performance. When consuming a record, I would like to be able to check if it can be grouped with some of the next records in the batch. If so, create a sub batch, handle it, and then commit the offsets for the last handled index in the batch. Proceed that way until the whole batch has been handled.

Adding the following method to the org.springframework.kafka.support.Acknowledgment interface seems like a suitable API change for the use case:

    void acknowledge(int index);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions