-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can we figure out which partition an EOF error is for? #94
Comments
I see, this is a piece of valuable information that we don't currently get. We could get the partition here: What is not clear for me (although I didn't think about it properly) is how to represent it in an error. Currently we have this Maybe we could change this type: fromMessagePtr :: RdKafkaMessageTPtr -> IO (Either KafkaError (ConsumerRecord (Maybe BS.ByteString) (Maybe BS.ByteString))) to something like data MessageConsumeError = MessageConsumeError
{ topic :: TopicName
, partition :: PartitionId
, error :: KafkaError
}
fromMessagePtr :: RdKafkaMessageTPtr -> IO (Either MessageConsumerError (ConsumerRecord (Maybe BS.ByteString) (Maybe BS.ByteString))) then it would allow us to reason about what happens and where in the scope of receiving messages... |
Yeah, it's unfortunately kind of an awkward API to adapt to Haskell idioms. I've been playing with a change that just models the C API faithfully, adding a I like your |
Yes, it never returns |
The C function for consuming always returns an
rd_kafka_message_t
, which contains anrd_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 therd_kafka_message_t
. For example, if you get a partition EOF, you'll have to inspect thepartition
field to determine which partition the EOF applies to.In contrast, the Haskell function for consuming is
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.The text was updated successfully, but these errors were encountered: