Package com.hazelcast.jet.pulsar
Class PulsarReaderBuilder<M,T>
java.lang.Object
com.hazelcast.jet.pulsar.PulsarReaderBuilder<M,T>
- Type Parameters:
M- the type of the message read bypulsarReaderT- the type of data emitted fromStreamSource
- Since:
- 6.0
-
Constructor Summary
ConstructorsConstructorDescriptionPulsarReaderBuilder(SupplierEx<org.apache.pulsar.client.api.Schema<M>> schemaSupplier) PulsarReaderBuilder(String topic, SupplierEx<org.apache.pulsar.client.api.PulsarClient> connectionSupplier, SupplierEx<org.apache.pulsar.client.api.Schema<M>> schemaSupplier, FunctionEx<org.apache.pulsar.client.api.Message<M>, T> projectionFn) Required fields of Pulsar reader -
Method Summary
Modifier and TypeMethodDescriptionbatchReceivePolicy(org.apache.pulsar.client.api.BatchReceivePolicy batchReceivePolicy) build()Creates and returns the Pulsar ReaderStreamSourcewith using builder configurations set before.connectionSupplier(SupplierEx<org.apache.pulsar.client.api.PulsarClient> connectionSupplier) dataConnectionRef(DataConnectionRef dataConnectionRef) By default, this connector usesmessage poolingfunctionality.PulsarReaderBuilder<M,org.apache.pulsar.client.api.Message<M>> MarksprojectionFn(FunctionEx)asFunctionEx.identity(), which also disables message pooling.initialOffset(org.apache.pulsar.client.api.MessageId startOffset) preferredLocalParallelism(int preferredLocalParallelism) Preferred local parallelism for every processor created by this builder.<NEW_T> PulsarReaderBuilder<M,NEW_T> projectionFn(FunctionEx<org.apache.pulsar.client.api.Message<M>, NEW_T> projectionFn) Provides function, that will convert Pulsar'sMessageto user-defined type.readerConfig(Map<String, Object> readerConfig) readerCustomizer(ConsumerEx<org.apache.pulsar.client.api.ReaderBuilder<M>> readerCustomizer) Allows additional customization and invocation of otherReaderBuildermethod, that doesn't have a representative here.
-
Constructor Details
-
PulsarReaderBuilder
-
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 fromconnectionSupplier- Pulsar client supplierschemaSupplier- Pulsar messaging schema supplier.projectionFn- converts a Pulsar message to an emitted item.
-
-
Method Details
-
topic
-
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'sMessageto 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 thanFunctionEx.identity()) as projection function, you need to disable pooling first viadisableMessagePooling().. -
identityProjectionFn
@Nonnull public PulsarReaderBuilder<M,org.apache.pulsar.client.api.Message<M>> identityProjectionFn()MarksprojectionFn(FunctionEx)asFunctionEx.identity(), which also disables message pooling. -
disableMessagePooling
By default, this connector usesmessage poolingfunctionality. If theMessageobjects must be available afterprojectionFn(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 otherReaderBuildermethod, that doesn't have a representative here. -
readerConfig
- Parameters:
readerConfig- Pulsar reader configurations that must contain reader name
-
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
Creates and returns the Pulsar ReaderStreamSourcewith using builder configurations set before.
-