Rename examples/tips to examples/pubsub
@ -460,15 +460,15 @@
]
},
{
"name": "tips_client_lib",
"name": "pubsub_client_lib",
"build": "private",
"language": "c++",
"src": [
"examples/tips/label.proto",
"examples/tips/empty.proto",
"examples/tips/pubsub.proto",
"examples/tips/publisher.cc",
"examples/tips/subscriber.cc"
"examples/pubsub/label.proto",
"examples/pubsub/empty.proto",
"examples/pubsub/pubsub.proto",
"examples/pubsub/publisher.cc",
"examples/pubsub/subscriber.cc"
],
"deps": [
"grpc++",
@ -1726,15 +1726,15 @@
"name": "tips_client",
"name": "pubsub_client",
"build": "test",
"run": false,
"examples/tips/main.cc"
"examples/pubsub/main.cc"
"tips_client_lib",
"pubsub_client_lib",
"grpc++_test_util",
"grpc_test_util",
@ -1744,14 +1744,14 @@
"name": "tips_publisher_test",
"name": "pubsub_publisher_test",
"examples/tips/publisher_test.cc"
"examples/pubsub/publisher_test.cc"
@ -1761,14 +1761,14 @@
"name": "tips_subscriber_test",
"name": "pubsub_subscriber_test",
"examples/tips/subscriber_test.cc"
"examples/pubsub/subscriber_test.cc"
@ -1,4 +1,4 @@
C++ Client implementation for Cloud Pub/Sub service (TIPS)
C++ Client implementation for Cloud Pub/Sub service
(https://developers.google.com/apis-explorer/#p/pubsub/v1beta1/).
"Google Cloud Pub/Sub" API needs to be enabled at
@ -11,16 +11,20 @@ be created with scope "https://www.googleapis.com/auth/cloud-platform" as below:
gcloud compute instances create instance-name
--image debian-7 --scopes https://www.googleapis.com/auth/cloud-platform
Google TLS cert is required to run the client, which can be downloaded from
Chrome browser.
To run the client from GCE:
make tips_client
bins/opt/tips_client --project_id="your project id"
make pubsub_client
GRPC_DEFAULT_SSL_ROOTS_FILE_PATH="Google TLS cert" bins/opt/pubsub_client
--project_id="your project id"
A service account credential is required to run the client from other
environments, which can be generated as a JSON key file from
https://console.developers.google.com/project/. To run the client with a service
account credential:
bins/opt/tips_client
--service_account_key_file="absolute path to the JSON key file"
@ -46,8 +46,8 @@
#include <grpc++/credentials.h>
#include <grpc++/status.h>
#include "examples/tips/publisher.h"
#include "examples/tips/subscriber.h"
#include "examples/pubsub/publisher.h"
#include "examples/pubsub/subscriber.h"
#include "test/cpp/util/create_test_channel.h"
DEFINE_int32(server_port, 443, "Server port.");
@ -82,7 +82,7 @@ grpc::string GetServiceAccountJsonKey() {
int main(int argc, char** argv) {
grpc_init();
google::ParseCommandLineFlags(&argc, &argv, true);
gpr_log(GPR_INFO, "Start TIPS client");
gpr_log(GPR_INFO, "Start PUBSUB client");
std::ostringstream ss;
@ -104,8 +104,8 @@ int main(int argc, char** argv) {
true, // use prod roots
creds));
grpc::examples::tips::Publisher publisher(channel);
grpc::examples::tips::Subscriber subscriber(channel);
grpc::examples::pubsub::Publisher publisher(channel);
grpc::examples::pubsub::Subscriber subscriber(channel);
GPR_ASSERT(FLAGS_project_id != "");
ss.str("");
@ -35,7 +35,7 @@
#include <grpc++/client_context.h>
using tech::pubsub::Topic;
using tech::pubsub::DeleteTopicRequest;
@ -48,7 +48,7 @@ using tech::pubsub::PubsubMessage;
namespace grpc {
namespace examples {
namespace tips {
namespace pubsub {
Publisher::Publisher(std::shared_ptr<ChannelInterface> channel)
: stub_(PublisherService::NewStub(channel)) {
@ -119,6 +119,6 @@ Status Publisher::Publish(const grpc::string& topic, const grpc::string& data) {
return stub_->Publish(&context, request, &response);
}
} // namespace tips
} // namespace pubsub
} // namespace examples
} // namespace grpc
@ -31,17 +31,17 @@
*
*/
#ifndef __GRPCPP_EXAMPLES_TIPS_PUBLISHER_H_
#define __GRPCPP_EXAMPLES_TIPS_PUBLISHER_H_
#ifndef __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_
#define __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_
#include <grpc++/channel_interface.h>
#include "examples/tips/pubsub.pb.h"
#include "examples/pubsub/pubsub.pb.h"
class Publisher {
public:
@ -60,8 +60,8 @@ class Publisher {
std::unique_ptr<tech::pubsub::PublisherService::Stub> stub_;
};
#endif // __GRPCPP_EXAMPLES_TIPS_PUBLISHER_H_
#endif // __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_
@ -43,7 +43,7 @@
#include <gtest/gtest.h>
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@ -112,7 +112,7 @@ class PublisherTest : public ::testing::Test {
channel_ = CreateChannel(server_address_.str(), ChannelArguments());
publisher_.reset(new grpc::examples::tips::Publisher(channel_));
publisher_.reset(new grpc::examples::pubsub::Publisher(channel_));
void TearDown() override {
@ -126,7 +126,7 @@ class PublisherTest : public ::testing::Test {
std::shared_ptr<ChannelInterface> channel_;
std::unique_ptr<grpc::examples::tips::Publisher> publisher_;
std::unique_ptr<grpc::examples::pubsub::Publisher> publisher_;
TEST_F(PublisherTest, TestPublisher) {
@ -4,8 +4,8 @@
syntax = "proto2";
import "examples/tips/empty.proto";
import "examples/tips/label.proto";
import "examples/pubsub/empty.proto";
import "examples/pubsub/label.proto";
package tech.pubsub;
@ -33,7 +33,7 @@
@ -46,7 +46,7 @@ using tech::pubsub::PubsubMessage;
Subscriber::Subscriber(std::shared_ptr<ChannelInterface> channel)
: stub_(SubscriberService::NewStub(channel)) {
@ -113,6 +113,6 @@ Status Subscriber::Pull(const grpc::string& name, grpc::string* data) {
return s;
#ifndef __GRPCPP_EXAMPLES_TIPS_SUBSCRIBER_H_
#define __GRPCPP_EXAMPLES_TIPS_SUBSCRIBER_H_
#ifndef __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_
#define __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_
class Subscriber {
@ -61,8 +61,8 @@ class Subscriber {
std::unique_ptr<tech::pubsub::SubscriberService::Stub> stub_;
#endif // __GRPCPP_EXAMPLES_TIPS_SUBSCRIBER_H_
#endif // __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_
@ -111,7 +111,7 @@ class SubscriberTest : public ::testing::Test {
subscriber_.reset(new grpc::examples::tips::Subscriber(channel_));
subscriber_.reset(new grpc::examples::pubsub::Subscriber(channel_));
@ -125,7 +125,7 @@ class SubscriberTest : public ::testing::Test {
std::unique_ptr<grpc::examples::tips::Subscriber> subscriber_;
std::unique_ptr<grpc::examples::pubsub::Subscriber> subscriber_;
TEST_F(SubscriberTest, TestSubscriber) {
@ -291,11 +291,11 @@
"name": "tips_publisher_test"
"name": "pubsub_publisher_test"
"name": "tips_subscriber_test"
"name": "pubsub_subscriber_test"
"language": "c",