22#include "data/BackendInterface.hpp"
23#include "etlng/ETLServiceInterface.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);
77 template <web::ng::SomeServer ServerType>
78 static std::function<void(boost::asio::yield_context)>
85 boost::asio::io_context& ioc
88 return [&](boost::asio::yield_context yield) {
90 coroutineGroup.
spawn(yield, [&server](
auto innerYield) {
91 server.stop(innerYield);
94 coroutineGroup.spawn(yield, [&balancer](
auto innerYield) {
95 balancer.
stop(innerYield);
98 coroutineGroup.asyncWait(yield);
103 subscriptions.
stop();
Application stopper class. On stop it will create a new thread to run all the shutdown tasks.
Definition Stopper.hpp:42
static std::function< void(boost::asio::yield_context)> makeOnStopCallback(ServerType &server, etlng::LoadBalancerInterface &balancer, etlng::ETLServiceInterface &etl, feed::SubscriptionManagerInterface &subscriptions, data::BackendInterface &backend, boost::asio::io_context &ioc)
Create a callback to be called on application stop.
Definition Stopper.hpp:79
~Stopper()
Destroy the Stopper object.
Definition Stopper.cpp:30
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:140
virtual void waitForWritesToFinish()=0
Wait for all pending writes to finish.
An interface for LoadBalancer.
Definition LoadBalancerInterface.hpp:45
virtual void stop(boost::asio::yield_context yield)=0
Stop the load balancer. This will stop all subscription sources.
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 accessible General logger at Severity::NFO severity.
Definition Logger.hpp:318
This namespace contains everything to do with the ETL and ETL sources.
Definition CacheLoader.hpp:39
This is a base class for any ETL service implementations.
Definition ETLServiceInterface.hpp:36