Class AdapterImplementationFactory
java.lang.Object
org.apache.pulsar.reactive.client.internal.adapter.AdapterImplementationFactory
Adapter implementation for
ReactivePulsarClient based on PulsarClient.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> reactor.core.publisher.Mono<T>adaptPulsarFuture(Supplier<? extends CompletableFuture<T>> futureSupplier) static org.apache.pulsar.reactive.client.api.ReactiveMessageSenderCacheCreates aReactiveMessageSenderCache.static org.apache.pulsar.reactive.client.api.ReactiveMessageSenderCachecreateCache(ProducerCacheProvider producerCacheProvider) Creates aReactiveMessageSenderCacheadapting the providedProducerCacheProvider.static org.apache.pulsar.reactive.client.api.ReactivePulsarClientcreateReactivePulsarClient(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.
-
Method Details
-
createReactivePulsarClient
public static org.apache.pulsar.reactive.client.api.ReactivePulsarClient createReactivePulsarClient(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
-
adaptPulsarFuture
public static <T> reactor.core.publisher.Mono<T> adaptPulsarFuture(Supplier<? extends CompletableFuture<T>> futureSupplier) - Type Parameters:
T- the internal type- Parameters:
futureSupplier- supplier of theCompletableFuture- Returns:
- the adapted
Mono
-
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
-