Java Code Examples for com.google.cloud.pubsub.v1.Subscriber#newBuilder()
The following examples show how to use
com.google.cloud.pubsub.v1.Subscriber#newBuilder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PubSubManager.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
private static Subscriber buildSubscriber(final PubSubConfig config, final PubSubMessageReceiver messageReceiver) { final ProjectSubscriptionName subscriptionName = ProjectSubscriptionName.of(config.getProjectId(), config.getSubscription()); final Subscriber.Builder subscriberBuilder = Subscriber.newBuilder(subscriptionName, messageReceiver); buildCredentialsProvider(config).ifPresent(subscriberBuilder::setCredentialsProvider); buildTransportChannelProvider(config).ifPresent(subscriberBuilder::setChannelProvider); return subscriberBuilder.build(); }
Example 2
Source File: DefaultSubscriberFactory.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
@Override public Subscriber createSubscriber(String subscriptionName, MessageReceiver receiver) { Subscriber.Builder subscriberBuilder = Subscriber.newBuilder( PubSubSubscriptionUtils.toProjectSubscriptionName(subscriptionName, this.projectId), receiver); if (this.channelProvider != null) { subscriberBuilder.setChannelProvider(this.channelProvider); } if (this.executorProvider != null) { subscriberBuilder.setExecutorProvider(this.executorProvider); } if (this.credentialsProvider != null) { subscriberBuilder.setCredentialsProvider(this.credentialsProvider); } if (this.headerProvider != null) { subscriberBuilder.setHeaderProvider(this.headerProvider); } if (this.systemExecutorProvider != null) { subscriberBuilder.setSystemExecutorProvider(this.systemExecutorProvider); } if (this.flowControlSettings != null) { subscriberBuilder.setFlowControlSettings(this.flowControlSettings); } if (this.maxAckExtensionPeriod != null) { subscriberBuilder.setMaxAckExtensionPeriod(this.maxAckExtensionPeriod); } if (this.parallelPullCount != null) { subscriberBuilder.setParallelPullCount(this.parallelPullCount); } return subscriberBuilder.build(); }