userver: userver/components/process_starter.hpp Source File
Loading...
Searching...
No Matches
process_starter.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/components/process_starter.hpp
4/// @brief @copybrief components::ProcessStarter
5
6#include <userver/components/component_base.hpp>
7
8#include <userver/engine/subprocess/process_starter.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace components {
13
14// clang-format off
15
16/// @ingroup userver_components
17///
18/// @brief Component for getting the engine::subprocess::ProcessStarter.
19///
20/// ## Static options:
21/// Name | Description | Default value
22/// ---- | ----------- | -------------
23/// task_processor | the name of the TaskProcessor for asynchronous process starting | `main-task-processor`
24
25// clang-format on
26class ProcessStarter final : public ComponentBase {
27 public:
28 /// @ingroup userver_component_names
29 /// @brief The default name of components::ProcessStarter component
30 static constexpr std::string_view kName = "process-starter";
31
32 ProcessStarter(const ComponentConfig& config,
33 const ComponentContext& context);
34
35 engine::subprocess::ProcessStarter& Get() { return process_starter_; }
36
37 static yaml_config::Schema GetStaticConfigSchema();
38
39 private:
40 engine::subprocess::ProcessStarter process_starter_;
41};
42
43template <>
44inline constexpr bool kHasValidate<ProcessStarter> = true;
45
46} // namespace components
47
48USERVER_NAMESPACE_END