Package io.micronaut.gcp.pubsub.support
Class DefaultPublisherFactory
java.lang.Object
io.micronaut.gcp.pubsub.support.DefaultPublisherFactory
- All Implemented Interfaces:
PublisherFactory
The default
PublisherFactory
implementation.
Creates Publisher
s for topics once, caches and reuses them.
Original source at : https://github.com/spring-cloud/spring-cloud-gcp/blob/master/spring-cloud-gcp-pubsub/src/main/java/org/springframework/cloud/gcp/pubsub/support/DefaultPublisherFactory.java
- Since:
- 2.0.0
- Author:
- João André Martins, Chengyuan Zhao, Vinicius Carvalho
-
Constructor Summary
ConstructorDescriptionDefaultPublisherFactory
(com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider, com.google.api.gax.core.CredentialsProvider credentialsProvider, io.micronaut.context.BeanContext beanContext) -
Method Summary
Modifier and TypeMethodDescriptioncom.google.cloud.pubsub.v1.Publisher
createPublisher
(@NonNull PublisherFactoryConfig config) Creates a publisher for a given topic.
-
Constructor Details
-
DefaultPublisherFactory
public DefaultPublisherFactory(@Named("pubsub") com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider, @Named("pubsub") com.google.api.gax.core.CredentialsProvider credentialsProvider, io.micronaut.context.BeanContext beanContext)
-
-
Method Details
-
createPublisher
public com.google.cloud.pubsub.v1.Publisher createPublisher(@NonNull @NonNull PublisherFactoryConfig config) Creates a publisher for a given topic.- Specified by:
createPublisher
in interfacePublisherFactory
- Parameters:
config
-PublisherFactoryConfig
object containing all required properties.- Returns:
- An instance of
Publisher
configured using the config and environment properties from `gcp.pubsub.publisher.>config_name<`
-