Class AdaptedReactivePulsarClientFactory
java.lang.Object
org.apache.pulsar.reactive.client.adapter.AdaptedReactivePulsarClientFactory
Class to create
ReactivePulsarClient and ReactiveMessageSenderCache.
instances.-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.pulsar.reactive.client.api.ReactivePulsarClientCreates a ReactivePulsarClient which will lazily call the provided supplier to get an instance of a Pulsar Client when needed.static org.apache.pulsar.reactive.client.api.ReactivePulsarClientcreate(org.apache.pulsar.client.api.PulsarClient pulsarClient) Creates a ReactivePulsarClient by wrapping an existing PulsarClient instance.static org.apache.pulsar.reactive.client.api.ReactiveMessageSenderCacheCreates aReactiveMessageSenderCache.static org.apache.pulsar.reactive.client.api.ReactiveMessageSenderCachecreateCache(ProducerCacheProvider producerCacheProvider) Creates aReactiveMessageSenderCacheadapting the providedProducerCacheProvider.
-
Method Details
-
create
public static org.apache.pulsar.reactive.client.api.ReactivePulsarClient create(org.apache.pulsar.client.api.PulsarClient pulsarClient) Creates a ReactivePulsarClient by wrapping an existing PulsarClient instance.- Parameters:
pulsarClient- the Pulsar Client instance to use- Returns:
- a ReactivePulsarClient instance
-
create
public static org.apache.pulsar.reactive.client.api.ReactivePulsarClient create(Supplier<org.apache.pulsar.client.api.PulsarClient> pulsarClientSupplier) Creates a ReactivePulsarClient which will lazily call the provided supplier to get an instance of a Pulsar Client when needed.- Parameters:
pulsarClientSupplier- the supplier to use for getting a Pulsar Client instance- Returns:
- a ReactivePulsarClient instance
-
createCache
public static org.apache.pulsar.reactive.client.api.ReactiveMessageSenderCache createCache(ProducerCacheProvider producerCacheProvider) Creates aReactiveMessageSenderCacheadapting the providedProducerCacheProvider.- Parameters:
producerCacheProvider- a ProducerCacheProvider instance- Returns:
- a ReactiveMessageSenderCache instance
-
createCache
public static org.apache.pulsar.reactive.client.api.ReactiveMessageSenderCache createCache()Creates aReactiveMessageSenderCache. If aProducerCacheProviderFactorycan be loaded by theServiceLoader, it is used to supply aProducerCacheProviderfrom which theReactiveMessageSenderCacheis adapted. Otherwise, theReactiveMessageSenderCacheis adapted from a newConcurrentHashMapProducerCacheProviderinstance.- Returns:
- a ReactiveMessageSenderCache instance
-