diff options
author | Chen Wang <chenw@google.com> | 2015-02-02 10:45:17 -0800 |
---|---|---|
committer | Chen Wang <chenw@google.com> | 2015-02-02 10:45:17 -0800 |
commit | b532ef897340701897975b673d35ef24b5da4825 (patch) | |
tree | a10e132f9c38c6b01aff93691736c3e487952939 /examples/tips/subscriber.cc | |
parent | 0010cdae47270a22fd4442835261c796ee565900 (diff) |
Impelment full logic of publish and subcribe.
Diffstat (limited to 'examples/tips/subscriber.cc')
-rw-r--r-- | examples/tips/subscriber.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/examples/tips/subscriber.cc b/examples/tips/subscriber.cc index 2e2370ee2d..6dae3ce3a9 100644 --- a/examples/tips/subscriber.cc +++ b/examples/tips/subscriber.cc @@ -56,8 +56,7 @@ void Subscriber::Shutdown() { stub_.reset(); } -Status Subscriber::CreateSubscription(const grpc::string& topic, - const grpc::string& name) { +Status Subscriber::CreateSubscription(const string& topic, const string& name) { tech::pubsub::Subscription request; tech::pubsub::Subscription response; ClientContext context; @@ -68,8 +67,7 @@ Status Subscriber::CreateSubscription(const grpc::string& topic, return stub_->CreateSubscription(&context, request, &response); } -Status Subscriber::GetSubscription(const grpc::string& name, - grpc::string* topic) { +Status Subscriber::GetSubscription(const string& name, string* topic) { tech::pubsub::GetSubscriptionRequest request; tech::pubsub::Subscription response; ClientContext context; @@ -81,8 +79,17 @@ Status Subscriber::GetSubscription(const grpc::string& name, return s; } -Status Subscriber::Pull(const grpc::string& name, - grpc::string* data) { +Status Subscriber::DeleteSubscription(const string& name) { + tech::pubsub::DeleteSubscriptionRequest request; + proto2::Empty response; + ClientContext context; + + request.set_subscription(name); + + return stub_->DeleteSubscription(&context, request, &response); +} + +Status Subscriber::Pull(const string& name, string* data) { tech::pubsub::PullRequest request; tech::pubsub::PullResponse response; ClientContext context; |