RTC Toolkit 6.0.0-pre2
Loading...
Searching...
No Matches
consulServiceRegistryAdapter.hpp
Go to the documentation of this file.
1
12
13#ifndef CONSULSERVICEREGISTRYADAPTER_HPP
14#define CONSULSERVICEREGISTRYADAPTER_HPP
15
16#include <memory>
17#include <ppconsul/agent.h>
18#include <string>
19
20#include <mal/Cii.hpp>
21
24
26
34public:
35 inline static const std::string SUPPORTED_URI_SCHEME = "consul";
36
37 ConsulServiceRegistryAdapter(const elt::mal::Uri& endpoint);
38 std::vector<std::string>
39 ListComponents(const std::string& service_type = COMPONENT_TYPE) override;
40 ServiceEndpoint Get(const std::string& comp_name,
41 const std::string& service_name,
42 const std::string& service_type,
43 const bool health_check) override;
48 bool IsComponent(const ppconsul::ServiceInfo& service_info,
49 const std::string& service_type = COMPONENT_TYPE);
50 ppconsul::ServiceInfo GetComponentDefinedInConsul(const std::string& comp_name,
51 const std::string& service_name,
52 const std::string& service_type);
53
54private:
55 static const std::string CONSUL_COMMON_SERVICE;
56 static const std::string CONSUL_NAME_KEY;
57 static const std::string CONSUL_TYPE_KEY;
58 static const std::string CONSUL_ENDPOINT_TYPE_KEY;
59 static const std::string CONSUL_ENDPOINT_URI_KEY;
60 static const std::string RUNTIME_REPO_ENDPOINT;
61 static const std::string PERSISTENT_REPO_ENDPOINT;
62 static const std::string OLDB_ENDPOINT;
63 static const std::string TELEGRAF_ENDPOINT;
64 std::unique_ptr<ppconsul::Consul> m_consul_client;
65 std::unique_ptr<ppconsul::agent::Agent> m_consul_agent;
66 std::map<std::string, ppconsul::ServiceInfo> services;
67 elt::mal::Uri sde;
68};
69
70} // namespace rtctk::componentFramework
71
72#endif // CONSULSERVICEREGISTRYADAPTER_HPP
std::vector< std::string > ListComponents(const std::string &service_type=COMPONENT_TYPE) override
Get known components.
Definition consulServiceRegistryAdapter.cpp:171
ServiceEndpoint GetPersistentRepoEndpoint() override
Get the Persistent Repository Endpoint from the service registry.
Definition consulServiceRegistryAdapter.cpp:229
bool IsComponent(const ppconsul::ServiceInfo &service_info, const std::string &service_type=COMPONENT_TYPE)
Definition consulServiceRegistryAdapter.cpp:237
ConsulServiceRegistryAdapter(const elt::mal::Uri &endpoint)
Definition consulServiceRegistryAdapter.cpp:45
ppconsul::ServiceInfo GetComponentDefinedInConsul(const std::string &comp_name, const std::string &service_name, const std::string &service_type)
Definition consulServiceRegistryAdapter.cpp:251
static const std::string SUPPORTED_URI_SCHEME
Definition consulServiceRegistryAdapter.hpp:35
ServiceEndpoint GetTelegrafEndpoint() override
Get the Telegraf Endpoint from the service registry.
Definition consulServiceRegistryAdapter.cpp:233
ServiceEndpoint GetRuntimeRepoEndpoint() override
Get the Runtime Repository Endpoint from the service registry.
Definition consulServiceRegistryAdapter.cpp:218
ServiceEndpoint GetOldbEndpoint() override
Get the Oldb Endpoint from the service registry.
Definition consulServiceRegistryAdapter.cpp:213
ServiceEndpoint Get(const std::string &comp_name, const std::string &service_name, const std::string &service_type, const bool health_check) override
Get endpoint of specific service of a specific component.
Definition consulServiceRegistryAdapter.cpp:60
Class that implements a service registry to be used by the service discovery.
Definition serviceRegistryIf.hpp:31
static const std::string COMPONENT_TYPE
the string for component type (default)
Definition serviceRegistryIf.hpp:60
elt::mal::Uri ServiceEndpoint
Definition serviceRegistryIf.hpp:43
Header file for DataPointPath.
Definition commandReplier.cpp:22
Class that implements the service registry interface.