Skip to content

SendMessageAsync of Producer not completing #115

Open
@garywlynn

Description

@garywlynn

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

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