Class DefaultPublisherFactory

  • All Implemented Interfaces:
    PublisherFactory

    @Singleton
    public class DefaultPublisherFactory
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      DefaultPublisherFactory​(com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider, com.google.api.gax.core.CredentialsProvider credentialsProvider, io.micronaut.context.BeanContext beanContext)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.cloud.pubsub.v1.Publisher createPublisher​(PublisherFactoryConfig config)
      Creates a publisher for a given topic.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • createPublisher

        public com.google.cloud.pubsub.v1.Publisher createPublisher​(@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<`