Class PulsarSinkBuilder<E,M>

java.lang.Object
com.hazelcast.jet.pulsar.PulsarSinkBuilder<E,M>
Type Parameters:
E - the type of stream item
M - the type of the message published by PulsarProducer

public final class PulsarSinkBuilder<E,M> extends Object
Since:
6.0
  • Constructor Details

    • PulsarSinkBuilder

      public PulsarSinkBuilder(@Nonnull SupplierEx<org.apache.pulsar.client.api.Schema<M>> schemaSupplier, @Nonnull FunctionEx<? super E,M> extractValueFn)
    • PulsarSinkBuilder

      public PulsarSinkBuilder(@Nonnull String topic, @Nonnull SupplierEx<org.apache.pulsar.client.api.PulsarClient> connectionSupplier, @Nonnull SupplierEx<org.apache.pulsar.client.api.Schema<M>> schemaSupplier, @Nonnull FunctionEx<? super E,M> extractValueFn)
      Required fields of Pulsar sink
      Parameters:
      topic - Pulsar topic name to publish to
      connectionSupplier - Pulsar client supplier
      extractValueFn - extracts the message value from the emitted items.
      schemaSupplier - Pulsar messaging schema supplier.
  • Method Details

    • inputType

      @Nonnull public <NEW_E> PulsarSinkBuilder<NEW_E,M> inputType(@Nonnull Class<NEW_E> type)
      Helper function to force type interference. PulsarSinkBuilder should be equal to PulsarSinkBuilder.
    • topic

      @Nonnull public PulsarSinkBuilder<E,M> topic(@Nonnull String topic)
    • connectionSupplier

      @Nonnull public PulsarSinkBuilder<E,M> connectionSupplier(@Nonnull SupplierEx<org.apache.pulsar.client.api.PulsarClient> connectionSupplier)
    • httpServiceUrl

      @Nonnull public PulsarSinkBuilder<E,M> httpServiceUrl(@Nonnull String httpServiceUrl)
    • dataConnectionRef

      @Nonnull public PulsarSinkBuilder<E,M> dataConnectionRef(@Nonnull DataConnectionRef dataConnectionRef)
    • producerConfig

      @Nonnull public PulsarSinkBuilder<E,M> producerConfig(Map<String,Object> producerConfig)
      Parameters:
      producerConfig - The configurations for PulsarProducer
    • extractKeyFn

      @Nonnull public PulsarSinkBuilder<E,M> extractKeyFn(FunctionEx<? super E,String> extractKeyFn)
      Parameters:
      extractKeyFn - extracts the message key from the emitted items.
    • extractValueFn

      @Nonnull public PulsarSinkBuilder<E,M> extractValueFn(FunctionEx<? super E,M> extractValueFn)
      Parameters:
      extractValueFn - extracts the message value from the emitted items.
    • extractPropertiesFn

      @Nonnull public PulsarSinkBuilder<E,M> extractPropertiesFn(FunctionEx<? super E,Map<String,String>> extractPropertiesFn)
      Parameters:
      extractPropertiesFn - extracts the message properties from the emitted items.
    • extractTimestampFn

      @Nonnull public PulsarSinkBuilder<E,M> extractTimestampFn(FunctionEx<? super E,Long> extractTimestampFn)
      Parameters:
      extractTimestampFn - the function that extracts the timestamp from the emitted item.
    • transactionTimeout

      @Nonnull public PulsarSinkBuilder<E,M> transactionTimeout(@Nonnull Duration transactionTimeout)
      Parameters:
      transactionTimeout - timeout for transactions, that will be used if there is processing guarantee specified for the job
    • useTransactions

      @Nonnull public PulsarSinkBuilder<E,M> useTransactions(boolean enable)
      Enables or disables the exactly-once behavior of the sink using two-phase commit of state snapshots. If enabled, the processing guarantee of the job must be set to exactly-once, otherwise the sink guarantee will match that of the job. In other words, sink guarantee cannot be higher than job's, but can be lowered to avoid the additional overhead.

      The default value is true.

      Parameters:
      enable - If true, sink guarantee will match the job guarantee. If false, sink guarantee will be at-least-once even if job's is exactly-once
      Returns:
      this instance for fluent API
    • preferredLocalParallelism

      public PulsarSinkBuilder<E,M> preferredLocalParallelism(int preferredLocalParallelism)
      Preferred local parallelism for every processor created by this builder.
    • producerCustomizer

      @Nonnull public PulsarSinkBuilder<E,M> producerCustomizer(@Nonnull ConsumerEx<@NonNull org.apache.pulsar.client.api.ProducerBuilder<M>> producerCustomizer)
      Customizer of the ProducerBuilder created by this sink.
    • build

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