mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-20 11:44:49 +00:00
Changes per code review
This commit is contained in:
@@ -72,7 +72,7 @@ struct PollInterface {
|
||||
*
|
||||
* Each call to poll() will first consume from the global event queue and if there are
|
||||
* no pending events, will attempt to consume from all partitions until a valid message is found.
|
||||
* The timeout used on this call will be the one configured via RoundRobinPollStrategy::set_timeout.
|
||||
* The timeout used on this call will be the one configured via PollInterface::set_timeout.
|
||||
*
|
||||
* \return A message. The returned message *might* be empty. It's necessary to check
|
||||
* that it's a valid one before using it (see example above).
|
||||
@@ -86,7 +86,7 @@ struct PollInterface {
|
||||
/**
|
||||
* \brief Polls for new messages
|
||||
*
|
||||
* Same as the other overload of RoundRobinPollStrategy::poll but the provided
|
||||
* Same as the other overload of PollInterface::poll but the provided
|
||||
* timeout will be used instead of the one configured on this Consumer.
|
||||
*
|
||||
* \param timeout The timeout to be used on this call
|
||||
@@ -113,7 +113,7 @@ struct PollInterface {
|
||||
/**
|
||||
* \brief Polls all assigned partitions for a batch of new messages in round-robin fashion
|
||||
*
|
||||
* Same as the other overload of RoundRobinPollStrategy::poll_batch but the provided
|
||||
* Same as the other overload of PollInterface::poll_batch but the provided
|
||||
* timeout will be used instead of the one configured on this Consumer.
|
||||
*
|
||||
* \param max_batch_size The maximum amount of messages expected
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace cppkafka {
|
||||
* related (user-specific) information.
|
||||
*/
|
||||
struct QueueData {
|
||||
Queue queue_;
|
||||
boost::any metadata_;
|
||||
Queue queue;
|
||||
boost::any metadata;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -52,8 +52,7 @@ struct QueueData {
|
||||
*
|
||||
* \brief Base implementation of the PollInterface
|
||||
*/
|
||||
class PollStrategyBase : public PollInterface
|
||||
{
|
||||
class PollStrategyBase : public PollInterface {
|
||||
public:
|
||||
using QueueMap = std::map<TopicPartition, QueueData>;
|
||||
|
||||
@@ -99,18 +98,6 @@ protected:
|
||||
*/
|
||||
QueueData& get_consumer_queue();
|
||||
|
||||
/**
|
||||
* \brief Return the next queue to be processed
|
||||
*
|
||||
* Depending on the polling strategy, each implementation must define it's own algorithm for
|
||||
* determining the next queue to poll.
|
||||
*
|
||||
* \param opaque Application specific data which can help determine the next queue.
|
||||
*
|
||||
* \return A partition queue
|
||||
*/
|
||||
virtual QueueData& get_next_queue(void* opaque = nullptr) = 0;
|
||||
|
||||
/**
|
||||
* \brief Reset the internal state of the queues.
|
||||
*
|
||||
|
||||
@@ -83,8 +83,7 @@ namespace cppkafka {
|
||||
* the Consumer instance it owns.
|
||||
*/
|
||||
|
||||
class RoundRobinPollStrategy : public PollStrategyBase
|
||||
{
|
||||
class RoundRobinPollStrategy : public PollStrategyBase {
|
||||
public:
|
||||
RoundRobinPollStrategy(Consumer& consumer);
|
||||
|
||||
@@ -112,16 +111,13 @@ public:
|
||||
std::chrono::milliseconds timeout) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* \sa PollStrategyBase::get_next_queue
|
||||
*/
|
||||
QueueData& get_next_queue(void* opaque = nullptr) final;
|
||||
|
||||
/**
|
||||
* \sa PollStrategyBase::reset_state
|
||||
*/
|
||||
void reset_state() final;
|
||||
|
||||
QueueData& get_next_queue();
|
||||
|
||||
private:
|
||||
void consume_batch(Queue& queue,
|
||||
MessageList& messages,
|
||||
|
||||
Reference in New Issue
Block a user