kaffe
kaffe copied to clipboard
handle_messages sometimes receives nil as argument
Hello there! First of all, congratulations on your work with this library and thanks a lot for it. We have been using it at DeepX with quite a degree of success this far, and it has been really helpful.
This issue started happening after 1.4.0, and we believe it to be related to the upgrade to brod 3.0.
Sometimes when Kaffe calls our implementation of handle_messages for batch message processing, it gives nil as argument, which gives us a crash when we try to use the given argument as an enumerator, such as below:
def handle_messages(messages) do
for message <- messages do
message.value
|> Poison.decode()
|> process_message(message.topic)
end
:ok
end
Could you clarify whether this is a bug or an intended case of this function? Thank you very much!
@cristianormd Hello! Glad you're having success with Kaffe!
That's an interesting issue. Are you receiving nil for messages or are you receiving [nil]? Looking at this code, I'm guessing the latter.
That's definitely not the intent. 😉 So I think this would be a defect in either Kaffe or Brod. Which version of Brod are you using?
I wonder if we're handing the message incorrectly in the subscriber for Brod 3. This might require some digging in Brod.
I don't think we've seen this issue yet. @cristianormd Would you like to try to isolate the issue, either in Kaffe or Brod?