Apollo client for c++ (unofficial).
- cpp-libhttp
- vcpkg
- ninja
- cmake
- pkg-config
make releasecmake -DCMAKE_BUILD_TYPE=Release -B release
cmake --build release -jfind_package(apollo-client CONFIG REQUIRED)
target_link_libraries(main apollo-client::apollo-client)#include "apollo/api.h"
// Init
apollo::ApolloClientOptions options{
.address = "81.68.181.139:8080",
.app_id = "000111",
.cluster = "default",
.secret_key = "4a46a5e6e6994c1599ddca631f09ecb3"};
apollo::ApolloClient client(options);
// with local cache
auto properties = client.GetProperties("application");
// without local cache
apollo::Properties properties;
auto status = client.GetPropertiesDirectly(properties, "application");
// Subscribe
client.Subscribe({{"application", "Public"}},
[](const std::string &nms, apollo::Properties &&p) {
spdlog::info("namespace Properties updated: {}", nms);
});
If you are looking for a vcpkg registry to integration this library, checking this one vcpkg-base.