public class CachingPublisherFactory extends Object implements PublisherFactory
PublisherFactory
.
Creates Publisher
s for topics once using delegate, caches and reuses them.
Constructor and Description |
---|
CachingPublisherFactory(PublisherFactory delegate)
Constructs a caching
PublisherFactory using the delegate. |
Modifier and Type | Method and Description |
---|---|
com.google.cloud.pubsub.v1.Publisher |
createPublisher(String topic)
Creates a
Publisher for a given topic. |
PublisherFactory |
getDelegate()
Returns the delegate.
|
void |
shutdown()
Shutdown all cached
Publisher gracefully. |
public CachingPublisherFactory(PublisherFactory delegate)
PublisherFactory
using the delegate.delegate
- a PublisherFactory
that needs to be cached.public com.google.cloud.pubsub.v1.Publisher createPublisher(String topic)
PublisherFactory
Publisher
for a given topic.createPublisher
in interface PublisherFactory
topic
- destination topicpublic PublisherFactory getDelegate()
@PreDestroy public void shutdown()
Publisher
gracefully.Copyright © 2023. All rights reserved.