22#include "data/BackendInterface.hpp"
23#include "etl/ETLService.hpp"
24#include "etl/LoadBalancer.hpp"
25#include "feed/SubscriptionManagerInterface.hpp"
26#include "util/CoroutineGroup.hpp"
27#include "util/log/Logger.hpp"
28#include "web/ng/Server.hpp"
30#include <boost/asio/executor_work_guard.hpp>
31#include <boost/asio/io_context.hpp>
32#include <boost/asio/spawn.hpp>
43 boost::asio::io_context ctx_;
58 setOnStop(std::function<
void(boost::asio::yield_context)> cb);
81 static std::function<void(boost::asio::yield_context)>
84 LoadBalancerType& balancer,
88 boost::asio::io_context& ioc
91 return [&](boost::asio::yield_context yield) {
93 coroutineGroup.
spawn(yield, [&server](
auto innerYield) {
94 server.stop(innerYield);
97 coroutineGroup.spawn(yield, [&balancer](
auto innerYield) {
98 balancer.stop(innerYield);
101 coroutineGroup.asyncWait(yield);
106 subscriptions.
stop();
Application stopper class. On stop it will create a new thread to run all the shutdown tasks.
Definition Stopper.hpp:42
~Stopper()
Destroy the Stopper object.
Definition Stopper.cpp:30
static std::function< void(boost::asio::yield_context)> makeOnStopCallback(ServerType &server, LoadBalancerType &balancer, ETLServiceType &etl, feed::SubscriptionManagerInterface &subscriptions, data::BackendInterface &backend, boost::asio::io_context &ioc)
Create a callback to be called on application stop.
Definition Stopper.hpp:82
void setOnStop(std::function< void(boost::asio::yield_context)> cb)
Set the callback to be called when the application is stopped.
Definition Stopper.cpp:37
void stop()
Stop the application and run the shutdown tasks.
Definition Stopper.cpp:43
The interface to the database used by Clio.
Definition BackendInterface.hpp:138
virtual void waitForWritesToFinish()=0
Wait for all pending writes to finish.
Interface of subscription manager. A subscription manager is responsible for managing the subscriptio...
Definition SubscriptionManagerInterface.hpp:44
virtual void stop()=0
Stop the SubscriptionManager and wait for all jobs to finish.
CoroutineGroup is a helper class to manage a group of coroutines. It allows to spawn multiple corouti...
Definition CoroutineGroup.hpp:37
bool spawn(boost::asio::yield_context yield, std::function< void(boost::asio::yield_context)> fn)
Spawn a new coroutine in the group.
Definition CoroutineGroup.cpp:45
static Logger::Pump info(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accesible General logger at Severity::NFO severity.
Definition Logger.hpp:316
Definition ETLService.hpp:70
Definition LoadBalancer.hpp:63
This namespace contains everything to do with the ETL and ETL sources.
Definition CacheLoader.hpp:36