Skip to content

KafkaConsumer is documented as returning a future, but returns None #1559

Closed
@ekimekim

Description

@ekimekim

in KafkaConsumer in kafka.consumer.group, the commit_async call is documented as returning a kafka.future.Future. While not stated outright now that I read it carefully, the obvious implication is that you can check that future to determine if your commit operation has succeeded or failed.

However, my observed behaviour is that I always get a None returned instead.

The code calls:

        future = self._coordinator.commit_offsets_async(
            offsets, callback=callback)
        return future

self._coordinator is a kafka.coordinator.consumer.ConsumerCoordinator. The relevant method commit_offsets_async does not return anything (hence, implicitly, it always returns None).

It does, however, call self._do_commit_offsets_async, which does return a Future. In another code path it instead gets a future and sets some callbacks on it.

It looks like the intent was for these futures in each code path to be returned from commit_offsets_async, but that code is missing.

Could you please either fix this to return the future as implied, or remove the erroneous documentation / make it clear the only way to confirm whether a commit was successful is to add a callback?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions