userver: components::Server Class Reference
Loading...
Searching...
No Matches
components::Server Class Referencefinal

#include <userver/server/component.hpp>

Detailed Description

Component that listens for incoming requests, manages incoming connections and passes the requests to the appropriate handler.

Starts listening and accepting connections only after all the components are loaded.

All the classes inherited from server::handlers::HttpHandlerBase and registered in components list bind to the components::Server component.

components::Server Dynamic config

Static options of components::Server :

Server is configured by 'listener' and 'listener-monitor' entries. 'listener' is a required entry that describes the request processing socket. 'listener-monitor' is an optional entry that describes the special monitoring socket, used for getting statistics and processing utility requests that should succeed even is the main socket is under heavy pressure.

Options inherited from components::RawComponentBase :

See also
HTTP, HTTPS, WebSocket

Definition at line 48 of file component.hpp.

+ Inheritance diagram for components::Server:

Public Member Functions

 Server (const components::ComponentConfig &component_config, const components::ComponentContext &component_context)
 
void OnAllComponentsLoaded () override
 
void OnAllComponentsAreStopping () override
 
const server::ServerGetServer () const
 
server::ServerGetServer ()
 
void AddHandler (const server::handlers::HttpHandlerBase &handler, engine::TaskProcessor &task_processor)
 
ComponentHealth GetComponentHealth () const override
 
void OnLoadingCancelled () override
 

Static Public Member Functions

static yaml_config::Schema GetStaticConfigSchema ()
 

Static Public Attributes

static constexpr std::string_view kName = "server"
 The default name of components::Server component.
 

Protected Types

using LoggableComponentBase = ComponentBase
 

Member Typedef Documentation

◆ LoggableComponentBase

Member Function Documentation

◆ GetComponentHealth()

ComponentHealth components::ComponentBase::GetComponentHealth ( ) const
inlineoverridevirtualinherited

Override this function to inform the world of the state of your component.

Warning
The function is called concurrently from multiple threads.

Reimplemented from components::RawComponentBase.

Reimplemented in server::handlers::Restart.

Definition at line 35 of file component_base.hpp.

◆ OnAllComponentsAreStopping()

void components::Server::OnAllComponentsAreStopping ( )
overridevirtual

Component may use this function to stop doing work before the stop of the components that depend on it.

Base components may override it and make final to do some work before the derived object constructor is called. Don't use it otherwise.

Reimplemented from components::ComponentBase.

◆ OnAllComponentsLoaded()

void components::Server::OnAllComponentsLoaded ( )
overridevirtual

Component may use this function to finalize registration of other components that depend on it (for example, handler components register in server component, and the latter uses OnAllComponentsLoaded() to start processing requests).

Base components may override it and make final to do some work after the derived object constructor is called. Don't use it otherwise.

Reimplemented from components::ComponentBase.

◆ OnLoadingCancelled()

void components::ComponentBase::OnLoadingCancelled ( )
inlineoverridevirtualinherited

Called once if the creation of any other component failed. If the current component expects some other component to take any action with the current component, this call is a signal that such action may never happen due to components loading was cancelled. Application components might not want to override it.

Reimplemented from components::RawComponentBase.

Definition at line 42 of file component_base.hpp.


The documentation for this class was generated from the following file: