Apollo C++ Client
C++ client for Apollo Configuration Center
|
Interface for the Apollo configuration center client. More...
#include <apollo_client.h>
Public Member Functions | |
virtual | ~ApolloClient ()=default |
Virtual destructor to ensure proper cleanup in derived classes. | |
virtual void | startLongPolling (int long_polling_interval_ms=long_poller_interval_default)=0 |
Starts a long polling thread for configuration updates. | |
virtual void | stopLongPolling ()=0 |
Stops the long polling thread. | |
virtual Configures | getConfigures (const NamespaceType &s_namespace)=0 |
Retrieves configuration values from the ApolloClient cache. | |
virtual void | setNotificationsListener (NotificationCallbackPtr notificationCallback)=0 |
Sets a callback for configuration change notifications. |
Interface for the Apollo configuration center client.
This interface allows applications to access and monitor configuration data stored in Apollo Configuration Center. It provides methods for retrieving configurations and receiving notifications when configuration changes occur.
|
pure virtual |
Retrieves configuration values from the ApolloClient cache.
Returns the configuration key-value pairs for the specified namespace. The values are retrieved from the ApolloClient's local cache, which is updated by the long polling thread.
s_namespace | The namespace to retrieve configurations from |
|
pure virtual |
Sets a callback for configuration change notifications.
Registers a callback function that will be invoked whenever configuration changes are detected. The callback receives the namespace that changed, the old and new configurations, and a detailed list of changes (added, modified, deleted items).
notificationCallback | A weak pointer to the callback function. Using a weak pointer ensures that the client doesn't hold a reference to an object that might be destroyed. |
|
pure virtual |
Starts a long polling thread for configuration updates.
Starts a background thread that periodically polls the Apollo server for configuration updates. When changes are detected, the notification callback (if set) will be invoked from the background thread.
long_polling_interval_ms | Interval in milliseconds between polling requests. If set to 0 or negative, long polling thread will not be started and configuration will not be updated. |
|
pure virtual |
Stops the long polling thread.
Stops the background polling thread if it's running. After calling this method, no further configuration updates will be received and no callbacks will be triggered. This method blocks until the polling thread has terminated.