Class CachingPublisherFactory

java.lang.Object
com.google.cloud.spring.pubsub.support.CachingPublisherFactory
All Implemented Interfaces:
PublisherFactory

public class CachingPublisherFactory extends Object implements PublisherFactory
The caching implementation of the PublisherFactory.

Creates Publishers for topics once using delegate, caches and reuses them.

  • Constructor Details

  • Method Details

    • createPublisher

      public com.google.cloud.pubsub.v1.Publisher createPublisher(String topic)
      Description copied from interface: PublisherFactory
      Creates a Publisher for a given topic.
      Specified by:
      createPublisher in interface PublisherFactory
      Parameters:
      topic - destination topic
      Returns:
      fully configured publisher
    • getDelegate

      public PublisherFactory getDelegate()
      Returns the delegate.
      Returns:
      the delegate.
    • shutdown

      @PreDestroy public void shutdown()
      Shutdown all cached Publisher gracefully.