Closed KiillThemAll closed 1 year ago
Im just curious how to pass all builds with -warnings-as-errors...
Hi, @KiillThemAll
Maybe you don't really need thepollMessages(int timeoutMs, std::deque<consumer::ConsumerRecord>& output)
interface. How about using the follwing instead?
std::vector<consumer::ConsumerRecord> recordsInVector = theCosumer.pollMessages(int timeoutMs);
std::deque<consumer::ConsumerRecord> recordsInDeque;
std::move(recordsInVector.begin(), recordsInVector.end(), recordsInDeque.begin());
According to https://en.cppreference.com/w/cpp/algorithm/move there will be additional complexity on moving vector to deque: last - first move assignments.
According to https://en.cppreference.com/w/cpp/algorithm/move there will be additional complexity on moving vector to deque: last - first move assignments. Exactly, the "Complixity" is
last-first
move assignments, -- so is the messages processing. If you're interested, could try profiling your app, -- here's not the place could be optimized.
There will be no std::move(recordsInVector.begin(), recordsInVector.end(), recordsInDeque.begin()); at all if we pass deque by reference.
There will be no std::move(recordsInVector.begin(), recordsInVector.end(), recordsInDeque.begin()); at all if we pass deque by reference.)
Hi, @KiillThemAll
I don't think it's a good idea to expose too many interfaces for people, -- there's already a std::vector<consumer::ConsumerRecord> poll(std::chrono::milliseconds)
, and that should be enough.
The poll(std::chrono::milliseconds timeout, std::vector<ConsumerRecord>& output)
should not be there, nor the poll(std::chrono::milliseconds timeout, std::deque<ConsumerRecord>& output)
,
So, in some later day, I'll submit a PR to remove poll(std::chrono::milliseconds timeout, std::vector<ConsumerRecord>& output)
...
So, in some later day, I'll submit a PR to remove
poll(std::chrono::milliseconds timeout, std::vector<ConsumerRecord>& output)
...
The interface has been removed with https://github.com/morganstanley/modern-cpp-kafka/pull/205
Im using poll results in internal queue -> added std::deque& arg variant to poll function