ah- / rdkafka-dotnet

C# Apache Kafka client
Other
242 stars 73 forks source link

"Error _BAD_MSG - Local: Bad message format" with sample producer code #64

Closed sarudak closed 8 years ago

sarudak commented 8 years ago

Running kafka_2.11-0.10.0.0 on my local machine (mac). Connection is coming from a windows VM.

My Code:

class Program
{
    private string _hostIp = "192.168.56.1";

    private async void WriteToQueue(string message)
    {
        using (Producer producer = new Producer(_hostIp + ":9092"))
        using (Topic topic = producer.Topic("test"))
        {
            byte[] data = Encoding.UTF8.GetBytes(message);
            DeliveryReport deliveryReport = await topic.Produce(data);
            Console.WriteLine($"Produced to Partition: {deliveryReport.Partition}, Offset: {deliveryReport.Offset}");
        }
    }

    static void Main(string[] args)
    {
        var program = new Program();
        program.WriteToQueue("Hello");
        Thread.Sleep(2000);
    }
}
sarudak commented 8 years ago

My mistake. My environment was not clean and a full restart resolved the issue. Apologies.