Class AdapterImplementationFactory

java.lang.Object
org.apache.pulsar.reactive.client.internal.adapter.AdapterImplementationFactory

public final class AdapterImplementationFactory extends Object
Adapter implementation for ReactivePulsarClient based on PulsarClient.
  • 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)
      Adapts a CompletableFuture returned by the PulsarClient operations to a Mono.
      Type Parameters:
      T - the internal type
      Parameters:
      futureSupplier - supplier of the CompletableFuture
      Returns:
      the adapted Mono
    • createCache

      public static org.apache.pulsar.reactive.client.api.ReactiveMessageSenderCache createCache(ProducerCacheProvider producerCacheProvider)
      Creates a ReactiveMessageSenderCache adapting the provided ProducerCacheProvider.
      Parameters:
      producerCacheProvider - a ProducerCacheProvider instance
      Returns:
      a ReactiveMessageSenderCache instance
    • createCache

      public static org.apache.pulsar.reactive.client.api.ReactiveMessageSenderCache createCache()
      Creates a ReactiveMessageSenderCache. If a ProducerCacheProviderFactory can be loaded by the ServiceLoader, it is used to supply a ProducerCacheProvider from which the ReactiveMessageSenderCache is adapted. Otherwise, the ReactiveMessageSenderCache is adapted from a new ConcurrentHashMapProducerCacheProvider instance.
      Returns:
      a ReactiveMessageSenderCache instance