Closed mesarvagya closed 9 years ago
Hi,
The library currently only implements the basic protocol of Kafka.
The Producer
class in Kafka does quite some work behind the scenes. It needs to get some metadata for the specified topic (in your case 'page_visits') and it uses some partitioner to calculate the partition, to which it wants to produce the message.
Implementing this with libkafka-asio
could look like this:
https://gist.github.com/danieljoos/59c6867f7d316505dad3
In line 138 ff., the example shows how the partition number can be calculated using the FNV-1a hashing algorithm. This is basically what Kafka's KeyedMessage
in combination with SimplePartitioner
does (please correct me if I'm wrong).
Tested it with VS 2010.
Hi danieljoos. Thanks for the insight on how the emulate the code. I will give it a go and notify you if it works as expected. Thank again.
Hi Daniel, I ran your code and viewed the output in windows using kafka-console-consumer.bat
. It did produced the message. Thanks once again.
On the official kafka page https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+Producer+Example , consider
I tried to emulate this piece of code into its equivalent C++ code. Based on your example code. I have tried:
I am using Windows VS2010.