Class DefaultPublisherFactory

java.lang.Object
io.micronaut.gcp.pubsub.support.DefaultPublisherFactory
All Implemented Interfaces:
PublisherFactory

@Singleton public class DefaultPublisherFactory extends Object implements PublisherFactory
The default PublisherFactory implementation.

Creates Publishers 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 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 interface PublisherFactory
      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<`