public static final GrpcSubscriberStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcSubscriberStub( SubscriberStubSettings.newBuilder().build(), clientContext, callableFactory); }
public static final GrpcPublisherStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcPublisherStub( PublisherStubSettings.newBuilder().build(), clientContext, callableFactory); }
@Override public SubscriberStubSettings build() throws IOException { return new SubscriberStubSettings(this); } }
private SubscriberStub getSubscriber(ProcessContext context) throws IOException { final SubscriberStubSettings subscriberStubSettings = SubscriberStubSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(getGoogleCredentials(context))) .build(); return GrpcSubscriberStub.create(subscriberStubSettings); } }
@Override public void shutdown() { stub.shutdown(); }
/** * Wait for all work has completed execution after a {@link #shutdown()} request, or the timeout * occurs, or the current thread is interrupted. * * <p>Call this method to make sure all resources are freed properly. */ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return publisherStub.awaitTermination(duration, unit); }
/** * Constructs an instance of GrpcSubscriberStub, using the given settings. This is protected so * that it is easy to make a subclass, but otherwise, the static factory methods should be * preferred. */ protected GrpcSubscriberStub(SubscriberStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcSubscriberCallableFactory()); }
@Override public PublisherStubSettings build() throws IOException { return new PublisherStubSettings(this); } }
/** * Constructs an instance of GrpcPublisherStub, using the given settings. This is protected so * that it is easy to make a subclass, but otherwise, the static factory methods should be * preferred. */ protected GrpcPublisherStub(PublisherStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcPublisherCallableFactory()); }
/** Returns a builder containing all the values of this settings class. */ public Builder toBuilder() { return new Builder(this); }
@Override public final void close() { shutdown(); }
@Override public boolean isTerminated() { return stub.isTerminated(); }
/** Returns the default service endpoint. */ public static String getDefaultEndpoint() { return PublisherStubSettings.getDefaultEndpoint(); }
/** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return PublisherStubSettings.defaultGrpcTransportProviderBuilder(); }
@Override public boolean isShutdown() { return stub.isShutdown(); }
@Override public void shutdownNow() { stub.shutdownNow(); }
@Override public void shutdown() { stub.shutdown(); }
public static final GrpcSubscriberStub create(ClientContext clientContext) throws IOException { return new GrpcSubscriberStub(SubscriberStubSettings.newBuilder().build(), clientContext); }
public static final GrpcPublisherStub create(ClientContext clientContext) throws IOException { return new GrpcPublisherStub(PublisherStubSettings.newBuilder().build(), clientContext); }
@Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); }