Package io.micronaut.gcp.pubsub.support
Class PubSubConfigurationFactory
java.lang.Object
io.micronaut.gcp.pubsub.support.PubSubConfigurationFactory
@Factory
@Requires(classes=com.google.cloud.pubsub.v1.Publisher.class)
public class PubSubConfigurationFactory
extends Object
Factory class to create default settings for PubSub Publisher and subscriber beans.
- Since:
- 2.0.0
- Author:
- Vinicius Carvalho
-
Constructor Summary
ConstructorDescriptionPubSubConfigurationFactory
(PubSubConfigurationProperties pubSubConfigurationProperties, GoogleCloudConfiguration googleCloudConfiguration) -
Method Summary
Modifier and TypeMethodDescriptioncom.google.api.gax.core.CredentialsProvider
credentialsProvider
(com.google.auth.oauth2.GoogleCredentials credentials) Returns a defaultCredentialsProvider
, allows users to override it and provide their own implementation.com.google.api.gax.rpc.TransportChannelProvider
localChannelProvider
(io.micronaut.context.env.Environment environment) com.google.api.gax.core.CredentialsProvider
Returns aNoCredentialsProvider
.com.google.api.gax.core.ExecutorProvider
com.google.api.gax.rpc.TransportChannelProvider
-
Constructor Details
-
PubSubConfigurationFactory
public PubSubConfigurationFactory(PubSubConfigurationProperties pubSubConfigurationProperties, GoogleCloudConfiguration googleCloudConfiguration)
-
-
Method Details
-
publisherExecutorProvider
@Singleton public com.google.api.gax.core.ExecutorProvider publisherExecutorProvider()- Returns:
- default
ExecutorProvider
-
transportChannelProvider
@Singleton @Named("pubsub") @Requires(missingProperty="pubsub.emulator.host") public com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider()- Returns:
- default
TransportChannelProvider
TransportChannelProvider
-
localChannelProvider
@Singleton @Named("pubsub") @Requires(property="pubsub.emulator.host") public com.google.api.gax.rpc.TransportChannelProvider localChannelProvider(io.micronaut.context.env.Environment environment) - Parameters:
environment
- - Micronaut Environment to fetch PUBSUB_EMULATOR_HOST value- Returns:
- a
TransportChannelProvider
that targets the PUBSUB_EMULATOR_HOST
-
credentialsProvider
@Singleton @Named("pubsub") @Requires(missingProperty="pubsub.emulator.host") public com.google.api.gax.core.CredentialsProvider credentialsProvider(com.google.auth.oauth2.GoogleCredentials credentials) Returns a defaultCredentialsProvider
, allows users to override it and provide their own implementation.- Parameters:
credentials
- default credentials, if not overridden by user should be provided byGoogleCredentialsFactory
- Returns:
- A
FixedCredentialsProvider
holding the given credentials.
-
noCredentialsProvider
@Singleton @Named("pubsub") @Requires(property="pubsub.emulator.host") public com.google.api.gax.core.CredentialsProvider noCredentialsProvider()Returns aNoCredentialsProvider
. Useful for when running with an emulator instead of targeting GCP Pub/Sub service.- Returns:
- A
NoCredentialsProvider
with no credentials.
-