Skip to content

How can we figure out which partition an EOF error is for? #94

@gridaphobe

Description

@gridaphobe

The C function for consuming always returns an rd_kafka_message_t, which contains an rd_kafka_resp_err_t in the case of failure. Unfortunately this error value is not self-contained, making sense of it may require inspecting other fields of the rd_kafka_message_t. For example, if you get a partition EOF, you'll have to inspect the partition field to determine which partition the EOF applies to.

In contrast, the Haskell function for consuming is

pollMessage :: MonadIO m
            => KafkaConsumer
            -> Timeout -- ^ the timeout, in milliseconds
            -> m (Either KafkaError (ConsumerRecord (Maybe BS.ByteString) (Maybe BS.ByteString))) -- ^ Left on error or timeout, right for success

This is a much more natural type since the error case is disjoint, but the KafkaError type is missing some crucial context. E.g. there appears to be no way for me to determine which partition hit the EOF. This is important if you want to consume the entire topic in one go and then stop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions