Class PulsarReaderBuilder<M,T>

java.lang.Object
com.hazelcast.jet.pulsar.PulsarReaderBuilder<M,T>
Type Parameters:
M - the type of the message read by pulsarReader
T - the type of data emitted from StreamSource

public final class PulsarReaderBuilder<M,T> extends Object
Since:
6.0
  • Constructor Details

    • PulsarReaderBuilder

      public PulsarReaderBuilder(SupplierEx<org.apache.pulsar.client.api.Schema<M>> schemaSupplier)
    • PulsarReaderBuilder

      public PulsarReaderBuilder(@Nonnull String topic, @Nonnull SupplierEx<org.apache.pulsar.client.api.PulsarClient> connectionSupplier, @Nonnull SupplierEx<org.apache.pulsar.client.api.Schema<M>> schemaSupplier, @Nonnull FunctionEx<org.apache.pulsar.client.api.Message<M>,T> projectionFn)
      Required fields of Pulsar reader
      Parameters:
      topic - Pulsar topic name to consume from
      connectionSupplier - Pulsar client supplier
      schemaSupplier - Pulsar messaging schema supplier.
      projectionFn - converts a Pulsar message to an emitted item.
  • Method Details

    • topic

      @Nonnull public PulsarReaderBuilder<M,T> topic(@Nonnull String... topics)
    • connectionSupplier

      @Nonnull public PulsarReaderBuilder<M,T> connectionSupplier(@Nonnull SupplierEx<org.apache.pulsar.client.api.PulsarClient> connectionSupplier)
    • dataConnectionRef

      @Nonnull public PulsarReaderBuilder<M,T> dataConnectionRef(@Nonnull DataConnectionRef dataConnectionRef)
    • projectionFn

      @Nonnull public <NEW_T> PulsarReaderBuilder<M,NEW_T> projectionFn(@Nonnull FunctionEx<org.apache.pulsar.client.api.Message<M>,NEW_T> projectionFn)
      Provides function, that will convert Pulsar's Message to user-defined type.

      Please note, that by default Pulsar connector uses message pooling, so if you want to use some kind of identity function (other than FunctionEx.identity()) as projection function, you need to disable pooling first via disableMessagePooling()..

    • identityProjectionFn

      @Nonnull public PulsarReaderBuilder<M,org.apache.pulsar.client.api.Message<M>> identityProjectionFn()
      Marks projectionFn(FunctionEx) as FunctionEx.identity(), which also disables message pooling.
    • disableMessagePooling

      @Nonnull public PulsarReaderBuilder<M,T> disableMessagePooling()
      By default, this connector uses message pooling functionality. If the Message objects must be available after projectionFn(FunctionEx) is applied, this functionality must be turned off.
    • readerCustomizer

      @Nonnull public PulsarReaderBuilder<M,T> readerCustomizer(@Nonnull ConsumerEx<org.apache.pulsar.client.api.ReaderBuilder<M>> readerCustomizer)
      Allows additional customization and invocation of other ReaderBuilder method, that doesn't have a representative here.
    • readerConfig

      @Nonnull public PulsarReaderBuilder<M,T> readerConfig(@Nonnull Map<String,Object> readerConfig)
      Parameters:
      readerConfig - Pulsar reader configurations that must contain reader name
    • preferredLocalParallelism

      public PulsarReaderBuilder<M,T> preferredLocalParallelism(int preferredLocalParallelism)
      Preferred local parallelism for every processor created by this builder.
    • batchReceivePolicy

      @Nonnull public PulsarReaderBuilder<M,T> batchReceivePolicy(@Nonnull org.apache.pulsar.client.api.BatchReceivePolicy batchReceivePolicy)
      Parameters:
      batchReceivePolicy - batch receive policy for the Reader
    • initialOffset

      @Nonnull public PulsarReaderBuilder<M,T> initialOffset(@Nonnull org.apache.pulsar.client.api.MessageId startOffset)
      Parameters:
      startOffset - message from which the reading will be started
    • build

      @Nonnull public StreamSource<T> build()
      Creates and returns the Pulsar Reader StreamSource with using builder configurations set before.