diff options
author | 2015-02-12 17:29:18 -0800 | |
---|---|---|
committer | 2015-02-12 17:29:18 -0800 | |
commit | 842325110d6730ca0cc4eb584ac820876528dd44 (patch) | |
tree | bba8efdd5aeab7aad1c2031246a47720f1c2ddf4 /examples | |
parent | bc91e25c3d39916fe55669cb045554e8f034d1af (diff) |
Rename examples/tips to examples/pubsub
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pubsub/README (renamed from examples/tips/README) | 12 | ||||
-rw-r--r-- | examples/pubsub/empty.proto (renamed from examples/tips/empty.proto) | 0 | ||||
-rw-r--r-- | examples/pubsub/label.proto (renamed from examples/tips/label.proto) | 0 | ||||
-rw-r--r-- | examples/pubsub/main.cc (renamed from examples/tips/main.cc) | 10 | ||||
-rw-r--r-- | examples/pubsub/publisher.cc (renamed from examples/tips/publisher.cc) | 6 | ||||
-rw-r--r-- | examples/pubsub/publisher.h (renamed from examples/tips/publisher.h) | 12 | ||||
-rw-r--r-- | examples/pubsub/publisher_test.cc (renamed from examples/tips/publisher_test.cc) | 6 | ||||
-rw-r--r-- | examples/pubsub/pubsub.proto (renamed from examples/tips/pubsub.proto) | 4 | ||||
-rw-r--r-- | examples/pubsub/subscriber.cc (renamed from examples/tips/subscriber.cc) | 6 | ||||
-rw-r--r-- | examples/pubsub/subscriber.h (renamed from examples/tips/subscriber.h) | 12 | ||||
-rw-r--r-- | examples/pubsub/subscriber_test.cc (renamed from examples/tips/subscriber_test.cc) | 6 |
11 files changed, 39 insertions, 35 deletions
diff --git a/examples/tips/README b/examples/pubsub/README index ae7d096c2e..b55083afc5 100644 --- a/examples/tips/README +++ b/examples/pubsub/README @@ -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 +GRPC_DEFAULT_SSL_ROOTS_FILE_PATH="Google TLS cert" bins/opt/pubsub_client --project_id="your project id" --service_account_key_file="absolute path to the JSON key file" diff --git a/examples/tips/empty.proto b/examples/pubsub/empty.proto index 86aaa846a2..86aaa846a2 100644 --- a/examples/tips/empty.proto +++ b/examples/pubsub/empty.proto diff --git a/examples/tips/label.proto b/examples/pubsub/label.proto index 6ac786f078..6ac786f078 100644 --- a/examples/tips/label.proto +++ b/examples/pubsub/label.proto diff --git a/examples/tips/main.cc b/examples/pubsub/main.cc index df9d984ae1..18c81c426d 100644 --- a/examples/tips/main.cc +++ b/examples/pubsub/main.cc @@ -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(""); diff --git a/examples/tips/publisher.cc b/examples/pubsub/publisher.cc index eae8731139..cdefd08662 100644 --- a/examples/tips/publisher.cc +++ b/examples/pubsub/publisher.cc @@ -35,7 +35,7 @@ #include <grpc++/client_context.h> -#include "examples/tips/publisher.h" +#include "examples/pubsub/publisher.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 diff --git a/examples/tips/publisher.h b/examples/pubsub/publisher.h index d8d7353826..8eb666aea5 100644 --- a/examples/tips/publisher.h +++ b/examples/pubsub/publisher.h @@ -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 <grpc++/status.h> -#include "examples/tips/pubsub.pb.h" +#include "examples/pubsub/pubsub.pb.h" namespace grpc { namespace examples { -namespace tips { +namespace pubsub { class Publisher { public: @@ -60,8 +60,8 @@ class Publisher { std::unique_ptr<tech::pubsub::PublisherService::Stub> stub_; }; -} // namespace tips +} // namespace pubsub } // namespace examples } // namespace grpc -#endif // __GRPCPP_EXAMPLES_TIPS_PUBLISHER_H_ +#endif // __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_ diff --git a/examples/tips/publisher_test.cc b/examples/pubsub/publisher_test.cc index 34737ae6ed..298a5a2703 100644 --- a/examples/tips/publisher_test.cc +++ b/examples/pubsub/publisher_test.cc @@ -43,7 +43,7 @@ #include <grpc++/status.h> #include <gtest/gtest.h> -#include "examples/tips/publisher.h" +#include "examples/pubsub/publisher.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) { diff --git a/examples/tips/pubsub.proto b/examples/pubsub/pubsub.proto index a2dd2f5ca8..c330f0cdac 100644 --- a/examples/tips/pubsub.proto +++ b/examples/pubsub/pubsub.proto @@ -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; diff --git a/examples/tips/subscriber.cc b/examples/pubsub/subscriber.cc index c0673223ae..18ce0721f6 100644 --- a/examples/tips/subscriber.cc +++ b/examples/pubsub/subscriber.cc @@ -33,7 +33,7 @@ #include <grpc++/client_context.h> -#include "examples/tips/subscriber.h" +#include "examples/pubsub/subscriber.h" using tech::pubsub::Topic; using tech::pubsub::DeleteTopicRequest; @@ -46,7 +46,7 @@ using tech::pubsub::PubsubMessage; namespace grpc { namespace examples { -namespace tips { +namespace pubsub { 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; } -} // namespace tips +} // namespace pubsub } // namespace examples } // namespace grpc diff --git a/examples/tips/subscriber.h b/examples/pubsub/subscriber.h index ed706ff170..e5f036f89f 100644 --- a/examples/tips/subscriber.h +++ b/examples/pubsub/subscriber.h @@ -31,17 +31,17 @@ * */ -#ifndef __GRPCPP_EXAMPLES_TIPS_SUBSCRIBER_H_ -#define __GRPCPP_EXAMPLES_TIPS_SUBSCRIBER_H_ +#ifndef __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ +#define __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ #include <grpc++/channel_interface.h> #include <grpc++/status.h> -#include "examples/tips/pubsub.pb.h" +#include "examples/pubsub/pubsub.pb.h" namespace grpc { namespace examples { -namespace tips { +namespace pubsub { class Subscriber { public: @@ -61,8 +61,8 @@ class Subscriber { std::unique_ptr<tech::pubsub::SubscriberService::Stub> stub_; }; -} // namespace tips +} // namespace pubsub } // namespace examples } // namespace grpc -#endif // __GRPCPP_EXAMPLES_TIPS_SUBSCRIBER_H_ +#endif // __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ diff --git a/examples/tips/subscriber_test.cc b/examples/pubsub/subscriber_test.cc index fda8909a02..65a9af394a 100644 --- a/examples/tips/subscriber_test.cc +++ b/examples/pubsub/subscriber_test.cc @@ -43,7 +43,7 @@ #include <grpc++/status.h> #include <gtest/gtest.h> -#include "examples/tips/subscriber.h" +#include "examples/pubsub/subscriber.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -111,7 +111,7 @@ class SubscriberTest : public ::testing::Test { channel_ = CreateChannel(server_address_.str(), ChannelArguments()); - subscriber_.reset(new grpc::examples::tips::Subscriber(channel_)); + subscriber_.reset(new grpc::examples::pubsub::Subscriber(channel_)); } void TearDown() override { @@ -125,7 +125,7 @@ class SubscriberTest : public ::testing::Test { std::shared_ptr<ChannelInterface> channel_; - std::unique_ptr<grpc::examples::tips::Subscriber> subscriber_; + std::unique_ptr<grpc::examples::pubsub::Subscriber> subscriber_; }; TEST_F(SubscriberTest, TestSubscriber) { |