Apollo C++ Client
C++ client for Apollo Configuration Center
Loading...
Searching...
No Matches
apollo_client.h File Reference

Apollo Configuration Center Client Library. More...

#include "apollo_types.h"

Go to the source code of this file.

Classes

class  apollo::client::ApolloClient
 Interface for the Apollo configuration center client. More...

Typedefs

using apollo::client::ClientPtr = std::shared_ptr<ApolloClient>
using apollo::client::NotificationCallback
using apollo::client::NotificationCallbackPtr = std::weak_ptr<NotificationCallback>

Functions

ClientPtr apollo::client::makeApolloClient (const std::string &apollo_url, const std::string &app_id, Opts &&opts=Opts(), LoggerPtr logger=nullptr)
 Creates a new Apollo client instance.

Detailed Description

Apollo Configuration Center Client Library.

Typedef Documentation

◆ NotificationCallback

using apollo::client::NotificationCallback
Initial value:
std::function<void(const NamespaceType& n, const Configures& olds, const Configures& news, Changes&& changes)>
std::string NamespaceType
Type alias for namespace identifiers.
Definition apollo_types.h:22
std::vector< Change > Changes
List of configuration changes.
Definition apollo_types.h:62
std::map< std::string, std::string > Configures
Map of key-value pairs representing a namespace's configuration.
Definition apollo_types.h:65

Function Documentation

◆ makeApolloClient()

ClientPtr apollo::client::makeApolloClient ( const std::string & apollo_url,
const std::string & app_id,
Opts && opts = Opts(),
LoggerPtr logger = nullptr )

Creates a new Apollo client instance.

The method will connect to the Apollo server and load configurations for initialization when created.

Parameters
apollo_urlApollo server URL (e.g., "http://apollo-service:8080" or "http://apollo-server.com")
app_idApplication ID registered in Apollo Configuration Center
optsClient options including cluster name, namespaces, and label
loggerOptional logger for diagnostic messages (nullptr for no logging)
Returns
A shared pointer to the created Apollo client instance
Exceptions
std::runtime_errorIf initialization fails (e.g., invalid URL or app_id)
Note
HTTP is the only supported protocol; HTTPS is not currently supported.