Skip to content

Commit

Permalink
Merge pull request #112 from Telecominfraproject/WIFI-13597-fix-kafka…
Browse files Browse the repository at this point in the history
…-producer-using-poll

Wifi 13597 fix kafka producer using poll
  • Loading branch information
i-chvets authored Jul 12, 2024
2 parents 894daa0 + 46b9524 commit a86c06d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/framework/KafkaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace OpenWifi {
NewMessage.partition(0);
NewMessage.payload(Msg->Payload());
Producer.produce(NewMessage);
Producer.flush();
Producer.poll((std::chrono::milliseconds) 0);
}
} catch (const cppkafka::HandleException &E) {
poco_warning(Logger_,
Expand All @@ -117,8 +117,13 @@ namespace OpenWifi {
} catch (...) {
poco_error(Logger_, "std::exception");
}
if (Queue_.size() == 0) {
// message queue is empty, flush all previously sent messages
Producer.flush();
}
Note = Queue_.waitDequeueNotification();
}
Producer.flush();
poco_information(Logger_, "Stopped...");
}

Expand Down Expand Up @@ -324,4 +329,4 @@ namespace OpenWifi {
partitions.front().get_partition()));
}

} // namespace OpenWifi
} // namespace OpenWifi

0 comments on commit a86c06d

Please sign in to comment.