44 using namespace std::literals::chrono_literals;
45 using std::this_thread::sleep_for;
50 using Application::Application;
55 const std::size_t n_of_batches = 2;
56 const std::size_t evts_in_batch = 5;
59 app->initialize().ignore();
68 app->start().ignore();
77 std::queue<EventContext> ready;
79 std::size_t evt_count = 0;
82 for ( std::size_t batch = 1; batch <= n_of_batches; ++batch ) {
86 log <<
MSG::INFO <<
" (pretend we need time so that the processing thread drains the input queue)"
89 log <<
MSG::INFO <<
" (all events in the queue should have been processed by now)" <<
endmsg;
91 for ( std::size_t i = 0; i < evts_in_batch; ++i ) {
93 auto ctx = qep->createEventContext();
96 ready.push( std::move(
ctx ) );
101 while ( !ready.empty() ) {
103 log <<
MSG::INFO <<
"- pushing event " << evt_count <<
" (" << ready.front() <<
")..." <<
endmsg;
104 qep->push( std::move( ready.front() ) );
110 if (
auto result = qep->pop() ) {
112 auto&& [sc,
ctx] = std::move( *result );
118 while ( !qep->empty() ) {
119 if (
auto result = qep->pop() ) {
120 auto&& [sc,
ctx] = std::move( *result );
132 app->stop().ignore();
133 app->finalize().ignore();