Class PulsarConsumerBuilder<M,T>
- Type Parameters:
M- the type of the value of message read byPulsarConsumerT- the type of the emitted item after projection.
- Since:
- 6.0
-
Constructor Summary
ConstructorsConstructorDescriptionPulsarConsumerBuilder(SupplierEx<org.apache.pulsar.client.api.Schema<M>> schemaSupplier, FunctionEx<org.apache.pulsar.client.api.Message<M>, T> projectionFn) PulsarConsumerBuilder(List<String> topics, 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) All-required fields constructor of Pulsar consumer, kept for compatibility with older code from hazeclast-jet-contrib repository. -
Method Summary
Modifier and TypeMethodDescriptionbatchReceivePolicySupplier(SupplierEx<org.apache.pulsar.client.api.BatchReceivePolicy> batchReceivePolicySupplier) build()Creates a Pulsar consumer source with the configured projection.connectionSupplier(SupplierEx<org.apache.pulsar.client.api.PulsarClient> connectionSupplier) consumerConfig(Map<String, Object> consumerConfig) consumerCustomizer(ConsumerEx<@NonNull org.apache.pulsar.client.api.ConsumerBuilder<M>> consumerCustomizer) Allows additional customization and invocation of otherConsumerBuildermethod, that doesn't have a representative here.dataConnectionRef(DataConnectionRef dataConnectionRef) preferredLocalParallelism(int preferredLocalParallelism) Preferred local parallelism for every processor created by this builder.<NEW_T> PulsarConsumerBuilder<M,NEW_T> projectionFn(FunctionEx<@NonNull org.apache.pulsar.client.api.Message<M>, NEW_T> projectionFn) subscriberName(String subscriberName)
-
Constructor Details
-
PulsarConsumerBuilder
public PulsarConsumerBuilder(@Nonnull SupplierEx<org.apache.pulsar.client.api.Schema<M>> schemaSupplier, @Nonnull FunctionEx<org.apache.pulsar.client.api.Message<M>, T> projectionFn) -
PulsarConsumerBuilder
public PulsarConsumerBuilder(@Nonnull List<String> topics, @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) All-required fields constructor of Pulsar consumer, kept for compatibility with older code from hazeclast-jet-contrib repository.- Parameters:
topics- the topics to consume, at least one is requiredconnectionSupplier- Pulsar client supplierschemaSupplier- supplies the schema for consuming messagesprojectionFn- converts a Pulsar message to an emitted item.
-
-
Method Details
-
topic
-
subscriberName
-
connectionSupplier
@Nonnull public PulsarConsumerBuilder<M,T> connectionSupplier(@Nonnull SupplierEx<org.apache.pulsar.client.api.PulsarClient> connectionSupplier) -
dataConnectionRef
@Nonnull public PulsarConsumerBuilder<M,T> dataConnectionRef(@Nonnull DataConnectionRef dataConnectionRef) -
projectionFn
@Nonnull public <NEW_T> PulsarConsumerBuilder<M,NEW_T> projectionFn(@Nonnull FunctionEx<@NonNull org.apache.pulsar.client.api.Message<M>, NEW_T> projectionFn) -
consumerCustomizer
@Nonnull public PulsarConsumerBuilder<M,T> consumerCustomizer(@Nonnull ConsumerEx<@NonNull org.apache.pulsar.client.api.ConsumerBuilder<M>> consumerCustomizer) Allows additional customization and invocation of otherConsumerBuildermethod, that doesn't have a representative here. -
consumerConfig
@Nonnull public PulsarConsumerBuilder<M,T> consumerConfig(@Nonnull Map<String, Object> consumerConfig) - Parameters:
consumerConfig- Pulsar consumer settings, subject to the same restrictions asconsumerCustomizer(ConsumerEx)
-
batchReceivePolicySupplier
@Nonnull public PulsarConsumerBuilder<M,T> batchReceivePolicySupplier(@Nonnull SupplierEx<org.apache.pulsar.client.api.BatchReceivePolicy> batchReceivePolicySupplier) - Parameters:
batchReceivePolicySupplier- supplies the batch receive policy for the consumer
-
preferredLocalParallelism
Preferred local parallelism for every processor created by this builder. -
build
Creates a Pulsar consumer source with the configured projection.Each physical topic is assigned to one processor using an exclusive, durable subscription. Use a subscription name dedicated to this source. Partition changes are discovered when the job restarts.
With
AT_LEAST_ONCEorEXACTLY_ONCE, the source acknowledges messages only after a successful snapshot and filters replayed messages using snapshotted positions. WithNONE, messages are acknowledged after emission. The broker must retain unacknowledged messages: message TTL, backlog eviction and subscription expiration must not discard them. Non-persistent topics cannot be used with snapshotting.Recovery uses the latest committed snapshot and the existing subscription. Restoring an older exported snapshot after newer acknowledgements is not supported. Snapshots written by the earlier consumer implementation are incompatible. End-to-end exactly-once also requires suitable downstream processors and sinks.
-