-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QC-1232] Improve log message when kafka broker url is missing #2437
Conversation
1ed0ad5
to
afe5fd1
Compare
{ "enable.auto.commit", { "true" } }, | ||
{ "auto.offset.reset", { "latest" } } } }; | ||
if (brokers.empty()) { | ||
constexpr std::string_view message{ "You are trying to start KafkaPoller without any brokers" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use a string_view
here ?
@@ -68,8 +68,25 @@ std::string createKafkaGroupId(std::string_view prefix, std::string_view detecto | |||
return groupId; | |||
} | |||
|
|||
bool checkKafkaParams(const std::string& kafkaBrokers, const std::string& topic, const std::string_view triggerTypeLogId) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genuine question: why don't you use a string_view for the first two arguments ?
I understand that the parameters you will give later in SOR are strings, but from the point of view of the interface, wouldn't it be better to have something uniform ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, all of these should be the same. Thanks for the remark
I generally prefer std::string_view
over const std::string&
because it is non owning and non allocating and read only class, so it 1) implies the usage, 2) allows you to use the function (generally speaking) allocating something/creating temporary string, 3) string_view can be used easily with wider range of classes: std::string
, const char*
, std::vector<char>
, ... But in this case the choice does not really matter...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok !
Co-authored-by: Piotr Konopka <piotr.jan.konopka@cern.ch>
better error handling when kafkaBrokers are missing