Comments (7)
Good catch, I didn't notice that one. Sounds like a good idea! There's no logging strategy at this point. At some point I wanted to use rdkafka's logging as it already exists but it's not exposed publicly, which kind of sucks. I guess for now just catching that would work.
from cppkafka.
Oh yeah, it would be great if it could tap into the existing logging.
Personally, I've never been a big fan of libraries logging in the first place, but there are situations like this where it's really the only viable response.
from cppkafka.
I think cppkafka could actually log through rdkafka via the configured log callback or rd_kafka_log_print
(the default) in case there's none. Reopening so I don't forget about this one.
from cppkafka.
One way to make it possible for a client to detect these kinds of errors would be to expose close()
to the public, which can then throw. But yes, the destructor should be assumed to be called while unwinding because of another exception.
from cppkafka.
Would this work? Not sure about the facility name...I used LOG_USER
Consumer::~Consumer() {
try {
// make sure to destroy the function closures. in case they hold kafka
// objects, they will need to be destroyed before we destroy the handle
assignment_callback_ = nullptr;
revocation_callback_ = nullptr;
rebalance_error_callback_ = nullptr;
close();
}
catch (const Exception& ex) {
auto& callback = get_configuration().get_log_callback();
if (callback) {
callback(*this, LOG_ERR, "user", ex.what());
}
else {
rd_kafka_log_print(get_handle(), LOG_ERR, "user", ex.what());
}
}
}
from cppkafka.
lol at "Reopening so I don't forget about this one.".
That looks good. I would probably change "user" to "cppkafka" so it's clear where the error is coming from.
from cppkafka.
Maybe this should be closed now...
from cppkafka.
Related Issues (20)
- Unable to find cppkafka/cppkafka.h HOT 1
- Failed to find valid rdkafka version
- make examples failure HOT 2
- Cannot pull using consumer HOT 1
- poll_batch does not trigger commit when auto.commit is true ? HOT 1
- How to remove topic using the API
- Consumer misbehavior with newer librdkafka versions HOT 1
- Can't build tests on Ubuntu 22.04 (Jammy)
- produer success but kafka shell consumer all "null" HOT 1
- How to use BufferedProducer to send binary data?
- Dll import function not allowed
- create BufferedProducer<std::string> producer globally
- Is there any way to build it without "boost"? HOT 1
- Please help me, I have tried a variety of methods to compile, all failed, including using the method provided by chatGPT 4.0. also failed. HOT 1
- How to set ttl?
- How to get number of messages in the topic?
- add_library(Rdkafka::rdkafka) issue
- CPPKafka crashes when trying to create a configuration in Windows
- What happens if Kafka was offline ? HOT 1
- Automate Compilation of "examples" in Build Process
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cppkafka.