cppkafka | Modern C++ Apache Kafka client library | Pub Sub library
kandi X-RAY | cppkafka Summary
kandi X-RAY | cppkafka Summary
cppkafka allows C++ applications to consume and produce messages using the Apache Kafka protocol. The library is built on top of librdkafka, and provides a high level API that uses modern C++ features to make it easier to write code while keeping the wrapper's performance overhead to a minimum.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cppkafka
cppkafka Key Features
cppkafka Examples and Code Snippets
Community Discussions
Trending Discussions on cppkafka
QUESTION
I need to get away from cmake, so I want to build a qmake project on mingw. Please help me understand what is missing. Build CPPKafka from https://github.com/mfontanini/cppkafka
main.cpp
...ANSWER
Answered 2020-Sep-01 at 12:05You need to add dllexport
to the struct HandleDeleter
and rebuild.
before include\cppkafka\kafka_handle_base.h
:
QUESTION
I'm trying to setup a Consumer and it is taking 5 seconds before initialization finishes and messages start getting received. I am using CppKafka (librdkafka wrapper), but I suspect it's a matter of me misconfiguring things rather than a library problem.
I was previously using kafka inside of docker and the startup delay was 10 seconds. I am now using this quickstart on the Kafka website and the startup delay is now at 5 seconds.
I have a ConsumeOne function that looks like this.
...ANSWER
Answered 2020-May-02 at 07:32This is now fixed in master (https://github.com/edenhill/librdkafka/commit/c64b652689c20dc7f2ce71eaf7166d9806c25096)
First message is now received between 80 - 100ms. Thanks for sorting it out!
QUESTION
I'm trying to use Kafka in a project that uses CMake to be built.
I have librdkafka-dev (version 0.8.6-1.1) installed.
I also tried downloading the project from Git and building it manually, which seem to be successful.
I noticed a README.md file in the librdkafka/packaging/cmake and followed its instructions, successfully creating a CMake build of librdkafka in the directory.
Running the 'cmake' command in my project results in the following error:
...ANSWER
Answered 2020-Feb-20 at 17:15This solved itself. Apparently, this was a bug with the CppKafka library and was already solved by the developers.
QUESTION
I am new to cmake and want to use the following external project in my program. (https://github.com/mfontanini/cppkafka) The idea is to download from git and build using cmake, which I have managed already. At the end of it, I am left with a .so file which I then have to link back to the main project. Any ideas on how I can achieve this ? Also, would like some suggestion on how to manage dependencies in a project with cmake that would possibly be carried forward to production.
...ANSWER
Answered 2018-Dec-05 at 10:21You can use the ExternalProject of cmake.
External project are downloaded in ${CMAKE_CURRENT_BINARY_DIR}/third-party
You can perform actions on them as target.
QUESTION
I'm using the following C++
code to produce messages to Kafka
:
ANSWER
Answered 2018-Dec-04 at 14:35Original Comment:
It is probably sort of spam prevention, i.e. sending messages out too quickly and the server is just ditching them
There are lots of different anti-spam techniques developed by web server providers. This is to stop somebody spamming your server by sending tonnes of web traffic. I think this is likely what you are doing
QUESTION
I've developed a couple of C++ apps that produce and consume Kafka messages (using cppkafka) embedding Protobuf3 messages. Both work fine. The producer's relevant code is:
...ANSWER
Answered 2018-Aug-23 at 05:45You can read kafka as ConsumerRecords
. And then SolidList.parseFrom(ByteBuffer.wrap(record.value().getBytes("UTF-8")));
QUESTION
I am trying to send a video stream through a Kafka topic and doing some processing between each messages consumption. This processing takes approximately 20 milliseconds, so after 100 frames, I have a consequent latency. I can detect this latency, however, I need to be able to force my consumer to read from the latest sent frame from the moment the latency is detected. I am aware that this would lead to many frames skipped.
I am using cppkafka which is based on librdkafka.
I can't find a lead that will put me in the right path since most of the answers are either different from my problem or use concepts existing only in other languages APIs.
Any thought on the matter ?
...ANSWER
Answered 2018-Jul-06 at 01:59A simple, if kind of brute, way to do it is to check the number of frames in the queue you have. If above a certain upper threshold then do a tight loop where you "consume" and discard (i.e. does no processing at all) of the frames until you reach your lower threshold (in your case one).
Once that tight loop is done you resume normal processing of the queue.
QUESTION
I am using CppKafka to programming Kafka consumer. I want when my consumer starts, it will only poll new arrival messages (i.e message arrive after the consumer-start-time) instead of messages at consumer offset.
...ANSWER
Answered 2018-May-18 at 08:51If "enable.auto.commit" is set as false and you do not commit offsets in your code, then every time your consumers starts it starts message consumption from the first message in the topic if auto.offset.reset=earliest.
The default for auto.offset.reset is “latest,” which means that lacking a valid offset, the consumer will start reading from the newest records (records that were written after the consumer started running).
Based on your question above it looks like auto.offset.reset=latest should solve your problem.
But if you need a real time based offset you need to apply the time filter in your consumer. That means get the message from the topic compare offset time with either on some custom field in message payload or the meta attribute of the message (ConsumerRecord.timestamp())and do further processing accordingly.
Also refer to this answer Retrieve Timestamp based data from Kafka
QUESTION
As mentioned in the cppkafka official GitHub in usage section.
If you want to use cppkafka, you'll need to link your application with:
- cppkafka
- rdkafka
I tried to compile example program mentioned in the README.md of the GitHub with
...ANSWER
Answered 2018-Apr-11 at 12:28No need of -D_GLIBCXX_USE_CXX11_ABI=0 option while compiling. you can simply compile this as following
QUESTION
I have a kafka consumer that does a poll every 10 seconds. I am using wireshark to monitor my network's acitvity.
I noticed that even when I am not doing any fetch requests, there is still traffic between the broker and my consumer. And I also noticed that it is the same packets (almost the same, only a slight change to the payload) that are sent and received periodically.
Is this some kind of keep alive packets? how to reduce them?
Here is a screenshot of those packets:
PS: I am using cppkafka as lib and kafka broker 0.8.2.2
EDIT: The client's code
...ANSWER
Answered 2018-Feb-16 at 14:43You probably see heartbeat messages to keep the consumer group alive, you can find more info about them here: https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-GroupMembershipAPI
It's possible to adjust the heartbeat interval by modifying heartbeat.interval.ms, check the librdkafka configuration.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cppkafka
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page