| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
🚧
This directory contains an idiomatic C++ client library for Cloud Pub/Sub Lite, a high-volume messaging service built for very low cost of operation by offering zonal storage and pre-provisioned capacity.
This library is experimental. Its APIs are subject to change without notice.
Please note that the Google Cloud C++ client libraries do not follow Semantic Versioning.
The quickstart/ directory contains a minimal environment to get started using this client library in a larger project. The following "Hello World" program is used in this quickstart, and should give you a taste of this library.
#include "google/cloud/pubsublite/admin_client.h"
#include "google/cloud/pubsublite/endpoint.h"
#include "google/cloud/common_options.h"
#include <iostream>
#include <stdexcept>
int main(int argc, char* argv[]) try {
if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " project-id zone-id\n";
return 1;
}
namespace gc = ::google::cloud;
namespace pubsublite = ::google::cloud::pubsublite;
auto const zone_id = std::string{argv[2]};
auto endpoint = pubsublite::EndpointFromZone(zone_id);
if (!endpoint) throw std::runtime_error(endpoint.status().message());
auto client =
pubsublite::AdminServiceClient(pubsublite::MakeAdminServiceConnection(
gc::Options{}
.set<gc::EndpointOption>(*endpoint)
.set<gc::AuthorityOption>(*endpoint)));
auto const parent =
std::string{"projects/"} + argv[1] + "/locations/" + zone_id;
for (auto const& topic : client.ListTopics(parent)) {
std::cout << topic.value().DebugString() << "\n";
}
return 0;
} catch (std::exception const& ex) {
std::cerr << "Standard exception raised: " << ex.what() << "\n";
return 1;
}See CONTRIBUTING.md for details on how to contribute to this project, including how to build and test your changes as well as how to properly format your code.
Apache 2.0; see LICENSE for details.
| Back | FazBrowse Home | New Git URL |