Class CachingPublisherFactory
java.lang.Object
com.google.cloud.spring.pubsub.support.CachingPublisherFactory
- All Implemented Interfaces:
PublisherFactory
The caching implementation of the
PublisherFactory.
Creates Publishers for topics once using delegate, caches and reuses them.
-
Constructor Summary
ConstructorsConstructorDescriptionCachingPublisherFactory(PublisherFactory delegate) Constructs a cachingPublisherFactoryusing the delegate. -
Method Summary
Modifier and TypeMethodDescriptioncom.google.cloud.pubsub.v1.PublishercreatePublisher(String topic) Creates aPublisherfor a given topic.Returns the delegate.voidshutdown()Shutdown all cachedPublishergracefully.
-
Constructor Details
-
CachingPublisherFactory
Constructs a cachingPublisherFactoryusing the delegate.- Parameters:
delegate- aPublisherFactorythat needs to be cached.
-
-
Method Details
-
createPublisher
Description copied from interface:PublisherFactoryCreates aPublisherfor a given topic.- Specified by:
createPublisherin interfacePublisherFactory- Parameters:
topic- destination topic- Returns:
- fully configured publisher
-
getDelegate
Returns the delegate.- Returns:
- the delegate.
-
shutdown
@PreDestroy public void shutdown()Shutdown all cachedPublishergracefully.
-