Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge branch pubsub-alpha from master #797

Closed
wants to merge 47 commits into from
Closed
Changes from 8 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a2cb76c
Initial GAX submission - generated classes only
garrettjonesgoogle Oct 30, 2015
ac33e48
Updating README.md to latest form
garrettjonesgoogle Nov 2, 2015
e0ee077
Updating version and installation module
garrettjonesgoogle Nov 2, 2015
1b054fa
Merge pull request #317 from garrettjonesgoogle/pubsub-alpha
aozarov Nov 3, 2015
56ad099
Adding GAX classes
garrettjonesgoogle Nov 3, 2015
02058b3
Adding implicit dependency, using constant instead of hardcoded string
garrettjonesgoogle Nov 4, 2015
5db3e21
Merge pull request #320 from garrettjonesgoogle/pubsub-alpha
aozarov Nov 4, 2015
1255189
Initial submission of generated pubsub protobuf classes
garrettjonesgoogle Nov 4, 2015
0d28942
Adding all sections to readme, with TODOs for missing content
garrettjonesgoogle Nov 5, 2015
9e3b1e4
Merge pull request #322 from garrettjonesgoogle/pubsub-alpha
aozarov Nov 5, 2015
5068e1b
Generated Pub/Sub client classes and unit tests
garrettjonesgoogle Nov 10, 2015
c952c20
Fixing source paths and module configuration
garrettjonesgoogle Nov 11, 2015
4fbfb7b
Updates to address PR comments.
garrettjonesgoogle Nov 17, 2015
add0cc3
More updates to address PR comments
garrettjonesgoogle Nov 19, 2015
b9d8555
Third round of updates to address PR comments
garrettjonesgoogle Nov 20, 2015
dea33f5
Merge pull request #345 from garrettjonesgoogle/pubsub-alpha
aozarov Nov 20, 2015
6150c26
Delete duplicate LocalPublisherImpl.java
pongad Nov 30, 2015
c47875a
Merge pull request #425 from pongad/pubsub-alpha
aozarov Nov 30, 2015
6450944
merge from upstream, fix merge confilict and fix build on non java 8
aozarov Jan 23, 2016
0ebb79d
Merge branch 'master' of git://github.com/GoogleCloudPlatform/gcloud-…
aozarov Feb 5, 2016
a6205da
merge from master
aozarov Feb 5, 2016
3e5f07f
fix pom to avoid compiler failure due to code generation by annotatio…
aozarov Feb 5, 2016
7bd63da
disable javadoc generation for java 8 on gcloud-java-pubsub
aozarov Feb 6, 2016
063d000
Merge pull request #576 from aozarov/pubsub-alpha
aozarov Feb 6, 2016
d28baaf
Merge branch 'master' of https://github.com/GoogleCloudPlatform/gclou…
aozarov Feb 12, 2016
171648a
Removing GAX from gcloud-java
garrettjonesgoogle Feb 18, 2016
65f2070
Removing generated files from gcloud-java-pubsub
garrettjonesgoogle Feb 18, 2016
4cf0c8f
Switching dependencies, regenerating code
garrettjonesgoogle Feb 18, 2016
25dbeef
Fixing root build
garrettjonesgoogle Feb 24, 2016
6b78851
Using version of GAX compatible with Java 1.7
garrettjonesgoogle Feb 24, 2016
c53e7ed
Merge pull request #661 from garrettjonesgoogle/pubsub-alpha
garrettjonesgoogle Feb 24, 2016
355369f
Fixing doc problems, improving formatting
garrettjonesgoogle Feb 25, 2016
51d32d5
Fixing javadoc error
garrettjonesgoogle Feb 25, 2016
d549d3f
Merge pull request #670 from garrettjonesgoogle/pubsub-alpha
aozarov Feb 26, 2016
b2115f3
Regenerating code, new settings classes
garrettjonesgoogle Mar 4, 2016
e85e69f
Updating to GAX 0.0.3
garrettjonesgoogle Mar 8, 2016
6a1f788
Surface updates from internal review
garrettjonesgoogle Mar 10, 2016
6701117
Using resurrected ServiceApiSettings in Settings classes
garrettjonesgoogle Mar 11, 2016
d0bc287
Updates due to code gen
garrettjonesgoogle Mar 11, 2016
a4609ca
Removing newSettings() method from XApi classes
garrettjonesgoogle Mar 16, 2016
5245e7d
Fixing build from last change
garrettjonesgoogle Mar 16, 2016
d1ece8a
Merge pull request #716 from garrettjonesgoogle/pubsub-alpha
garrettjonesgoogle Mar 16, 2016
6d90384
Putting spi files under spi.v1
garrettjonesgoogle Mar 16, 2016
e32afa6
Merge pull request #758 from garrettjonesgoogle/pubsub-alpha
aozarov Mar 17, 2016
95a1f90
Bundling descriptor for Publish
garrettjonesgoogle Mar 18, 2016
e369b3c
Regenerating (fixing style issues)
garrettjonesgoogle Mar 22, 2016
1a0e970
Merge pull request #776 from garrettjonesgoogle/pubsub-alpha
garrettjonesgoogle Mar 22, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,340 @@
/*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/

/*
* EDITING INSTRUCTIONS
* This file was generated from the file
* https://github.com/google/googleapis/blob/master/google/pubsub/v1/pubsub.proto
* and updates to that file get reflected here through a refresh process.
* For the short term, the refresh process will only be runnable by Google engineers.
* Manual additions are allowed because the refresh process performs
* a 3-way merge in order to preserve those manual additions. In order to not
* break the refresh process, only certain types of modifications are
* allowed.
*
* Allowed modifications - currently these are the only types allowed:
* 1. New methods (these should be added to the end of the class)
* 2. New imports
* 3. Additional documentation between "manual edit" demarcations
*
* Happy editing!
*/

package com.google.gcloud.pubsub.spi;

import com.google.api.gax.core.BackoffParams;
import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetryParams;
import com.google.api.gax.grpc.ApiCallSettings;
import com.google.api.gax.grpc.ApiCallable.ApiCallableBuilder;
import com.google.api.gax.grpc.ApiCallable.PageStreamingApiCallableBuilder;
import com.google.api.gax.grpc.PageDescriptor;
import com.google.api.gax.grpc.ServiceApiSettings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
import com.google.pubsub.v1.GetTopicRequest;
import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
import com.google.pubsub.v1.ListTopicSubscriptionsResponse;
import com.google.pubsub.v1.ListTopicsRequest;
import com.google.pubsub.v1.ListTopicsResponse;
import com.google.pubsub.v1.PublishRequest;
import com.google.pubsub.v1.PublishResponse;
import com.google.pubsub.v1.PublisherGrpc;
import com.google.pubsub.v1.Topic;
import io.grpc.Status;

// Manually-added imports: add custom (non-generated) imports after this point.

// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing.
@javax.annotation.Generated("by GAPIC")
public class PublisherSettings extends ServiceApiSettings {

// =========
// Constants
// =========

/**
* The default address of the service.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
public static final String DEFAULT_SERVICE_ADDRESS = "pubsub-experimental.googleapis.com";

/**
* The default port of the service.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
public static final int DEFAULT_SERVICE_PORT = 443;

/**
* The default scopes of the service.
*/
public static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
ImmutableList.<String>builder()
.add("https://www.googleapis.com/auth/pubsub")
.add("https://www.googleapis.com/auth/cloud-platform")
.build();

private static final ImmutableMap<String, ImmutableSet<Status.Code>> RETRYABLE_CODE_DEFINITIONS;

static {
ImmutableMap.Builder<String, ImmutableSet<Status.Code>> definitions = ImmutableMap.builder();
definitions.put(
"idempotent",
Sets.immutableEnumSet(
Lists.<Status.Code>newArrayList(
Status.Code.DEADLINE_EXCEEDED, Status.Code.UNAVAILABLE)));
definitions.put("non_idempotent", Sets.immutableEnumSet(Lists.<Status.Code>newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}

private static final ImmutableMap<String, RetryParams> RETRY_PARAM_DEFINITIONS;

static {
ImmutableMap.Builder<String, RetryParams> definitions = ImmutableMap.builder();
RetryParams params = null;
params =
RetryParams.newBuilder()
.setRetryBackoff(
BackoffParams.newBuilder()
.setInitialDelayMillis(100L)
.setDelayMultiplier(1.2)
.setMaxDelayMillis(1000L)
.build())
.setTimeoutBackoff(
BackoffParams.newBuilder()
.setInitialDelayMillis(300L)
.setDelayMultiplier(1.3)
.setMaxDelayMillis(3000L)
.build())
.setTotalTimeout(30000L)
.build();
definitions.put("default", params);
RETRY_PARAM_DEFINITIONS = definitions.build();
}

private static class MethodBuilders {
private final ApiCallableBuilder<Topic, Topic> createTopicMethod;
private final ApiCallableBuilder<PublishRequest, PublishResponse> publishMethod;
private final ApiCallableBuilder<GetTopicRequest, Topic> getTopicMethod;
private final PageStreamingApiCallableBuilder<ListTopicsRequest, ListTopicsResponse, Topic>
listTopicsMethod;
private final PageStreamingApiCallableBuilder<
ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>
listTopicSubscriptionsMethod;
private final ApiCallableBuilder<DeleteTopicRequest, Empty> deleteTopicMethod;
private final ImmutableList<? extends ApiCallSettings> allMethods;

public MethodBuilders() {
createTopicMethod = new ApiCallableBuilder<>(PublisherGrpc.METHOD_CREATE_TOPIC);
createTopicMethod.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"));
createTopicMethod.setRetryParams(RETRY_PARAM_DEFINITIONS.get("default"));

publishMethod = new ApiCallableBuilder<>(PublisherGrpc.METHOD_PUBLISH);
publishMethod.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"));
publishMethod.setRetryParams(RETRY_PARAM_DEFINITIONS.get("default"));

getTopicMethod = new ApiCallableBuilder<>(PublisherGrpc.METHOD_GET_TOPIC);
getTopicMethod.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"));
getTopicMethod.setRetryParams(RETRY_PARAM_DEFINITIONS.get("default"));

listTopicsMethod =
new PageStreamingApiCallableBuilder<>(
PublisherGrpc.METHOD_LIST_TOPICS, LIST_TOPICS_PAGE_STR_DESC);
listTopicsMethod.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"));
listTopicsMethod.setRetryParams(RETRY_PARAM_DEFINITIONS.get("default"));

listTopicSubscriptionsMethod =
new PageStreamingApiCallableBuilder<>(
PublisherGrpc.METHOD_LIST_TOPIC_SUBSCRIPTIONS,
LIST_TOPIC_SUBSCRIPTIONS_PAGE_STR_DESC);
listTopicSubscriptionsMethod.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"));
listTopicSubscriptionsMethod.setRetryParams(RETRY_PARAM_DEFINITIONS.get("default"));

deleteTopicMethod = new ApiCallableBuilder<>(PublisherGrpc.METHOD_DELETE_TOPIC);
deleteTopicMethod.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"));
deleteTopicMethod.setRetryParams(RETRY_PARAM_DEFINITIONS.get("default"));

allMethods =
ImmutableList.<ApiCallSettings>builder()
.add(
createTopicMethod,
publishMethod,
getTopicMethod,
listTopicsMethod,
listTopicSubscriptionsMethod,
deleteTopicMethod)
.build();
}
}

private final MethodBuilders methods;

// ===============
// Factory Methods
// ===============

/**
* Constructs an instance of PublisherSettings with default settings.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
public static PublisherSettings create() {
PublisherSettings settings = new PublisherSettings(new MethodBuilders());
settings.provideChannelWith(
ConnectionSettings.builder()
.setServiceAddress(DEFAULT_SERVICE_ADDRESS)
.setPort(DEFAULT_SERVICE_PORT)
.provideCredentialsWith(DEFAULT_SERVICE_SCOPES)
.build());
return settings;
}

/**
* Constructs an instance of PublisherSettings with default settings. This is protected so that it
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
protected PublisherSettings(MethodBuilders methods) {
super(methods.allMethods);
this.methods = methods;
}

/**
* Returns the ApiCallableBuilder for the API method createTopic.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
public ApiCallableBuilder<Topic, Topic> createTopicMethod() {
return methods.createTopicMethod;
}

/**
* Returns the ApiCallableBuilder for the API method publish.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
public ApiCallableBuilder<PublishRequest, PublishResponse> publishMethod() {
return methods.publishMethod;
}

/**
* Returns the ApiCallableBuilder for the API method getTopic.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
public ApiCallableBuilder<GetTopicRequest, Topic> getTopicMethod() {
return methods.getTopicMethod;
}

/**
* Returns the PageStreamingApiCallableBuilder for the API method listTopics.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
public PageStreamingApiCallableBuilder<ListTopicsRequest, ListTopicsResponse, Topic>
listTopicsMethod() {
return methods.listTopicsMethod;
}

/**
* Returns the PageStreamingApiCallableBuilder for the API method listTopicSubscriptions.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
public PageStreamingApiCallableBuilder<
ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>
listTopicSubscriptionsMethod() {
return methods.listTopicSubscriptionsMethod;
}

/**
* Returns the ApiCallableBuilder for the API method deleteTopic.
*
* <!-- manual edit -->
* <!-- end manual edit -->
*/
public ApiCallableBuilder<DeleteTopicRequest, Empty> deleteTopicMethod() {
return methods.deleteTopicMethod;
}

private static PageDescriptor<ListTopicsRequest, ListTopicsResponse, Topic>
LIST_TOPICS_PAGE_STR_DESC =
new PageDescriptor<ListTopicsRequest, ListTopicsResponse, Topic>() {
@Override
public Object emptyToken() {
return "";
}

@Override
public ListTopicsRequest injectToken(ListTopicsRequest payload, Object token) {
return ListTopicsRequest.newBuilder(payload).setPageToken((String) token).build();
}

@Override
public Object extractNextToken(ListTopicsResponse payload) {
return payload.getNextPageToken();
}

@Override
public Iterable<Topic> extractResources(ListTopicsResponse payload) {
return payload.getTopicsList();
}
};

private static PageDescriptor<
ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>
LIST_TOPIC_SUBSCRIPTIONS_PAGE_STR_DESC =
new PageDescriptor<
ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>() {
@Override
public Object emptyToken() {
return "";
}

@Override
public ListTopicSubscriptionsRequest injectToken(
ListTopicSubscriptionsRequest payload, Object token) {
return ListTopicSubscriptionsRequest.newBuilder(payload)
.setPageToken((String) token)
.build();
}

@Override
public Object extractNextToken(ListTopicSubscriptionsResponse payload) {
return payload.getNextPageToken();
}

@Override
public Iterable<String> extractResources(ListTopicSubscriptionsResponse payload) {
return payload.getSubscriptionsList();
}
};
}
Loading