Skip to content
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

SendMessageAsync of Producer not completing #115

Open
garywlynn opened this issue May 4, 2018 · 0 comments
Open

SendMessageAsync of Producer not completing #115

garywlynn opened this issue May 4, 2018 · 0 comments

Comments

@garywlynn
Copy link

garywlynn commented May 4, 2018

I've run into an issue when sending a set of messages to producer.SendMessageAsync such that the await Task.WhenAll statement seems to drop out before the tasks are complete. The function returns "{not yet computed}" for the Result and "Waiting for Activation" for the status. I do know that the sending of the data was successful, because the full dataset appeared within my Kafka application.

My solution to this problem was to simply make a synchronous version of the SendMessage function with the following signature:

public List<ProduceResponse> SendMessage(string topic, IEnumerable<Message> messages, Int16 acks = 1, TimeSpan? timeout = null, MessageCodec codec = MessageCodec.CodecNone)

The only difference between this and the original function is that I used Task.WaitAll instead of await Task.WhenAll:

Task.WaitAll(batch.Select(x => x.Tcs.Task).ToArray());

So now the questions:

  1. Any idea as to the cause of the issue with the async version?
  2. Is this a good solution to the problem, or is there a better one?
  3. Should I submit this alternative function as a pull request?

Thanks much.

Gary Lynn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant