Skip to content

Commit

Permalink
Updated surface and tests
Browse files Browse the repository at this point in the history
Regenerated surface using edited proto
Removed blank line from comments in generator snip
Updated DefaultPubSubRpc with provideChannelWith
  • Loading branch information
michaelbausor committed May 4, 2016
1 parent 773f3f9 commit 319529a
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
* <code>
* try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
* String name = "";
*
* Topic callResult = publisherApi.createTopic(name);
* }
* </code>
Expand Down Expand Up @@ -324,7 +323,7 @@ public final ApiCallable<Topic, Topic> createTopicCallable() {

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
* does not exist. The message payload must not be empty; it must contain
* either a non-empty data field, or at least one attribute.
*
Expand All @@ -344,7 +343,7 @@ public final PublishResponse publish(String topic, List<PubsubMessage> messages)

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
* does not exist. The message payload must not be empty; it must contain
* either a non-empty data field, or at least one attribute.
*
Expand All @@ -360,7 +359,7 @@ public PublishResponse publish(PublishRequest request) {

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
* does not exist. The message payload must not be empty; it must contain
* either a non-empty data field, or at least one attribute.
*
Expand Down Expand Up @@ -527,7 +526,7 @@ public final PageAccessor<String> listTopicSubscriptions(ListTopicSubscriptionsR

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
* does not exist. After a topic is deleted, a new topic may be created with
* the same name; this is an entirely new topic with none of the old
* configuration or subscriptions. Existing subscriptions to this topic are
Expand All @@ -547,7 +546,7 @@ public final void deleteTopic(String topic) {

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
* does not exist. After a topic is deleted, a new topic may be created with
* the same name; this is an entirely new topic with none of the old
* configuration or subscriptions. Existing subscriptions to this topic are
Expand All @@ -565,7 +564,7 @@ private void deleteTopic(DeleteTopicRequest request) {

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
* does not exist. After a topic is deleted, a new topic may be created with
* the same name; this is an entirely new topic with none of the old
* configuration or subscriptions. Existing subscriptions to this topic are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
* String topic = "";
* PushConfig pushConfig = PushConfig.newBuilder().build();
* int ackDeadlineSeconds = 0;
*
* Subscription callResult = subscriberApi.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
* }
* </code>
Expand Down Expand Up @@ -316,8 +315,8 @@ public void close() throws IOException {
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Creates a subscription to a given topic for a given subscriber.
* If the subscription already exists, returns `ALREADY_EXISTS`.
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
* If the subscription already exists, generates `ALREADY_EXISTS`.
* If the corresponding topic doesn't exist, generates `NOT_FOUND`.
*
* If the name is not provided in the request, the server will assign a random
* name for this subscription on the same project as the topic.
Expand All @@ -332,8 +331,6 @@ public void close() throws IOException {
* plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
* in length, and it must not start with `"goog"`.
* @param topic The name of the topic from which this subscription is receiving messages.
* The value of this field will be `_deleted-topic_` if the topic has been
* deleted.
* @param pushConfig If push delivery is used with this subscription, this field is
* used to configure it. An empty `pushConfig` signifies that the subscriber
* will pull and ack messages using API methods.
Expand Down Expand Up @@ -373,8 +370,8 @@ public final Subscription createSubscription(
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Creates a subscription to a given topic for a given subscriber.
* If the subscription already exists, returns `ALREADY_EXISTS`.
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
* If the subscription already exists, generates `ALREADY_EXISTS`.
* If the corresponding topic doesn't exist, generates `NOT_FOUND`.
*
* If the name is not provided in the request, the server will assign a random
* name for this subscription on the same project as the topic.
Expand All @@ -392,8 +389,8 @@ public Subscription createSubscription(Subscription request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Creates a subscription to a given topic for a given subscriber.
* If the subscription already exists, returns `ALREADY_EXISTS`.
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
* If the subscription already exists, generates `ALREADY_EXISTS`.
* If the corresponding topic doesn't exist, generates `NOT_FOUND`.
*
* If the name is not provided in the request, the server will assign a random
* name for this subscription on the same project as the topic.
Expand All @@ -411,6 +408,9 @@ public final ApiCallable<Subscription, Subscription> createSubscriptionCallable(
/**
* Gets the configuration details of a subscription.
*
* If the topic of a subscription has been deleted, the subscription itself is
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*
Expand All @@ -428,6 +428,9 @@ public final Subscription getSubscription(String subscription) {
/**
* Gets the configuration details of a subscription.
*
* If the topic of a subscription has been deleted, the subscription itself is
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*
Expand All @@ -442,6 +445,9 @@ private Subscription getSubscription(GetSubscriptionRequest request) {
/**
* Gets the configuration details of a subscription.
*
* If the topic of a subscription has been deleted, the subscription itself is
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
Expand All @@ -455,6 +461,9 @@ public final ApiCallable<GetSubscriptionRequest, Subscription> getSubscriptionCa
/**
* Lists matching subscriptions.
*
* If the topic of a subscription has been deleted, the subscription itself is
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*
Expand All @@ -471,6 +480,9 @@ public final PageAccessor<Subscription> listSubscriptions(String project) {
/**
* Lists matching subscriptions.
*
* If the topic of a subscription has been deleted, the subscription itself is
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*
Expand All @@ -485,6 +497,9 @@ public final PageAccessor<Subscription> listSubscriptions(ListSubscriptionsReque
/**
* Lists matching subscriptions.
*
* If the topic of a subscription has been deleted, the subscription itself is
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
Expand All @@ -497,6 +512,9 @@ public final PageAccessor<Subscription> listSubscriptions(ListSubscriptionsReque
/**
* Lists matching subscriptions.
*
* If the topic of a subscription has been deleted, the subscription itself is
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
Expand All @@ -510,7 +528,7 @@ public final PageAccessor<Subscription> listSubscriptions(ListSubscriptionsReque
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Deletes an existing subscription. All pending messages in the subscription
* are immediately dropped. Calls to `Pull` after deletion will return
* are immediately dropped. Calls to `Pull` after deletion will generate
* `NOT_FOUND`. After a subscription is deleted, a new one may be created with
* the same name, but the new one has no association with the old
* subscription, or its topic unless the same topic is specified.
Expand All @@ -531,7 +549,7 @@ public final void deleteSubscription(String subscription) {
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Deletes an existing subscription. All pending messages in the subscription
* are immediately dropped. Calls to `Pull` after deletion will return
* are immediately dropped. Calls to `Pull` after deletion will generate
* `NOT_FOUND`. After a subscription is deleted, a new one may be created with
* the same name, but the new one has no association with the old
* subscription, or its topic unless the same topic is specified.
Expand All @@ -549,7 +567,7 @@ private void deleteSubscription(DeleteSubscriptionRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Deletes an existing subscription. All pending messages in the subscription
* are immediately dropped. Calls to `Pull` after deletion will return
* are immediately dropped. Calls to `Pull` after deletion will generate
* `NOT_FOUND`. After a subscription is deleted, a new one may be created with
* the same name, but the new one has no association with the old
* subscription, or its topic unless the same topic is specified.
Expand Down Expand Up @@ -694,7 +712,7 @@ public final ApiCallable<AcknowledgeRequest, Empty> acknowledgeCallable() {
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Pulls messages from the server. Returns an empty list if there are no
* messages available in the backlog. The server may return `UNAVAILABLE` if
* messages available in the backlog. The server may generate `UNAVAILABLE` if
* there are too many concurrent pull requests pending for the given
* subscription.
*
Expand All @@ -705,8 +723,7 @@ public final ApiCallable<AcknowledgeRequest, Empty> acknowledgeCallable() {
* @param returnImmediately If this is specified as true the system will respond immediately even if
* it is not able to return a message in the `Pull` response. Otherwise the
* system is allowed to wait until at least one message is available rather
* than returning no messages. The client may cancel the request if it does
* not wish to wait any longer for the response.
* than returning no messages.
* @param maxMessages The maximum number of messages returned for this request. The Pub/Sub
* system may return fewer than the number specified.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
Expand All @@ -725,7 +742,7 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Pulls messages from the server. Returns an empty list if there are no
* messages available in the backlog. The server may return `UNAVAILABLE` if
* messages available in the backlog. The server may generate `UNAVAILABLE` if
* there are too many concurrent pull requests pending for the given
* subscription.
*
Expand All @@ -742,7 +759,7 @@ public PullResponse pull(PullRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Pulls messages from the server. Returns an empty list if there are no
* messages available in the backlog. The server may return `UNAVAILABLE` if
* messages available in the backlog. The server may generate `UNAVAILABLE` if
* there are too many concurrent pull requests pending for the given
* subscription.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.pubsub.spi;

import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
import com.google.api.gax.grpc.ApiCallSettings;
import com.google.api.gax.grpc.ApiException;
Expand Down Expand Up @@ -69,15 +68,15 @@ public DefaultPubSubRpc(PubSubOptions options) throws IOException {
try {
// Provide (and use a common thread-pool).
// This depends on https://github.com/googleapis/gax-java/issues/73
PublisherSettings.Builder pbuilder = PublisherSettings.defaultBuilder();
pbuilder.provideChannelWith(ConnectionSettings.newBuilder()
.provideCredentialsWith(options.authCredentials().credentials()).build());
pbuilder.applyToAllApiMethods(apiCallSettings(options));
PublisherSettings.Builder pbuilder =
PublisherSettings.defaultBuilder()
.provideChannelWith(options.authCredentials().credentials())
.applyToAllApiMethods(apiCallSettings(options));
publisherApi = PublisherApi.create(pbuilder.build());
SubscriberSettings.Builder sBuilder = SubscriberSettings.defaultBuilder();
sBuilder.provideChannelWith(ConnectionSettings.newBuilder()
.provideCredentialsWith(options.authCredentials().credentials()).build());
sBuilder.applyToAllApiMethods(apiCallSettings(options));
SubscriberSettings.Builder sBuilder =
SubscriberSettings.defaultBuilder()
.provideChannelWith(options.authCredentials().credentials())
.applyToAllApiMethods(apiCallSettings(options));
subscriberApi = SubscriberApi.create(sBuilder.build());
} catch (Exception ex) {
throw new IOException(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
* <code>
* try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
* String name = "";
*
* Topic callResult = publisherApi.createTopic(name);
* }
* </code>
Expand Down Expand Up @@ -324,7 +323,7 @@ public final ApiCallable<Topic, Topic> createTopicCallable() {

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
* does not exist. The message payload must not be empty; it must contain
* either a non-empty data field, or at least one attribute.
*
Expand All @@ -344,7 +343,7 @@ public final PublishResponse publish(String topic, List<PubsubMessage> messages)

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
* does not exist. The message payload must not be empty; it must contain
* either a non-empty data field, or at least one attribute.
*
Expand All @@ -360,7 +359,7 @@ public PublishResponse publish(PublishRequest request) {

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
* does not exist. The message payload must not be empty; it must contain
* either a non-empty data field, or at least one attribute.
*
Expand Down Expand Up @@ -527,7 +526,7 @@ public final PageAccessor<String> listTopicSubscriptions(ListTopicSubscriptionsR

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
* does not exist. After a topic is deleted, a new topic may be created with
* the same name; this is an entirely new topic with none of the old
* configuration or subscriptions. Existing subscriptions to this topic are
Expand All @@ -547,7 +546,7 @@ public final void deleteTopic(String topic) {

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
* does not exist. After a topic is deleted, a new topic may be created with
* the same name; this is an entirely new topic with none of the old
* configuration or subscriptions. Existing subscriptions to this topic are
Expand All @@ -565,7 +564,7 @@ private void deleteTopic(DeleteTopicRequest request) {

// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
/**
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
* does not exist. After a topic is deleted, a new topic may be created with
* the same name; this is an entirely new topic with none of the old
* configuration or subscriptions. Existing subscriptions to this topic are
Expand Down
Loading

0 comments on commit 319529a

Please sign in to comment.