54 using OnDisconnectHook = std::function<void(
Connection const&)>;
55 using TargetToHandlerMap = std::unordered_map<std::string, MessageHandler, util::StringHash, std::equal_to<>>;
61 ProcessingPolicy processingPolicy_;
62 std::optional<size_t> maxParallelRequests_;
64 std::reference_wrapper<util::TagDecoratorFactory> tagFactory_;
65 std::optional<size_t> maxSubscriptionSendQueueSize_;
67 OnDisconnectHook onDisconnectHook_;
69 TargetToHandlerMap getHandlers_;
70 TargetToHandlerMap postHandlers_;
71 std::optional<MessageHandler> wsHandler_;
73 boost::signals2::signal<void()> onStop_;
74 std::unique_ptr<std::atomic_bool> stopping_ = std::make_unique<std::atomic_bool>(
false);
76 std::reference_wrapper<util::prometheus::GaugeInt> connectionsCounter_ =
83 ProcessingPolicy processingPolicy,
84 std::optional<size_t> maxParallelRequests,
86 std::optional<size_t> maxSubscriptionSendQueueSize,
87 OnDisconnectHook onDisconnectHook
92 static constexpr std::chrono::milliseconds kCLOSE_CONNECTION_TIMEOUT{500};
95 onGet(std::string
const& target, MessageHandler handler);
98 onPost(std::string
const& target, MessageHandler handler);
101 onWs(MessageHandler handler);
104 processConnection(ConnectionPtr connection, boost::asio::yield_context yield);
107 stopConnection(
Connection& connection, boost::asio::yield_context yield);
110 stop(boost::asio::yield_context yield);
124 handleError(Error
const& error,
Connection const& connection)
const;
134 sequentRequestResponseLoop(
137 boost::asio::yield_context yield
141 parallelRequestResponseLoop(
144 boost::asio::yield_context yield
152 boost::asio::yield_context yield
160 boost::asio::yield_context yield
static util::prometheus::GaugeInt & gaugeInt(std::string name, util::prometheus::Labels labels, std::optional< std::string > description=std::nullopt)
Get an integer based gauge metric. It will be created if it doesn't exist.
Definition Prometheus.cpp:210
std::shared_ptr< SubscriptionContextInterface > SubscriptionContextPtr
An alias for shared pointer to a SubscriptionContextInterface.
Definition SubscriptionContextInterface.hpp:86