OutT
- The type written out to the cluster by the Egress.public final class KafkaEgressBuilder<OutT>
extends java.lang.Object
EgressSpec
that writes data out to a Kafka cluster. By
default the egress will use withAtLeastOnceProducerSemantics()
.Modifier and Type | Method and Description |
---|---|
KafkaEgressSpec<OutT> |
build() |
static <OutT> KafkaEgressBuilder<OutT> |
forIdentifier(EgressIdentifier<OutT> egressIdentifier) |
KafkaEgressBuilder<OutT> |
withAtLeastOnceProducerSemantics()
KafkaProducerSemantic.AT_LEAST_ONCE the egress will wait for all outstanding messages in the
Kafka buffers to be acknowledged by the Kafka producer on a checkpoint.
|
KafkaEgressBuilder<OutT> |
withExactlyOnceProducerSemantics(java.time.Duration transactionTimeoutDuration)
KafkaProducerSemantic.EXACTLY_ONCE the egress will write all messages in a Kafka transaction
that will be committed to Kafka on a checkpoint.
|
KafkaEgressBuilder<OutT> |
withKafkaAddress(java.lang.String kafkaAddress) |
KafkaEgressBuilder<OutT> |
withKafkaProducerPoolSize(int poolSize) |
KafkaEgressBuilder<OutT> |
withNoProducerSemantics()
KafkaProducerSemantic.NONE means that nothing will be guaranteed.
|
KafkaEgressBuilder<OutT> |
withProducerSemantic(KafkaProducerSemantic producerSemantic) |
KafkaEgressBuilder<OutT> |
withProperties(java.util.Properties properties)
Configuration properties for the KafkaProducer.
|
KafkaEgressBuilder<OutT> |
withProperty(java.lang.String key,
java.lang.String value)
A configuration property for the KafkaProducer.
|
KafkaEgressBuilder<OutT> |
withSerializer(java.lang.Class<? extends KafkaEgressSerializer<OutT>> serializer) |
public static <OutT> KafkaEgressBuilder<OutT> forIdentifier(EgressIdentifier<OutT> egressIdentifier)
OutT
- The type the egress will output.egressIdentifier
- A unique egress identifier.KafkaIngressBuilder
.public KafkaEgressBuilder<OutT> withKafkaAddress(java.lang.String kafkaAddress)
kafkaAddress
- Comma separated addresses of the brokers.public KafkaEgressBuilder<OutT> withProperty(java.lang.String key, java.lang.String value)
public KafkaEgressBuilder<OutT> withProperties(java.util.Properties properties)
public KafkaEgressBuilder<OutT> withSerializer(java.lang.Class<? extends KafkaEgressSerializer<OutT>> serializer)
serializer
- A serializer schema for turning user objects into a kafka-consumable byte[]
supporting key/value messages.public KafkaEgressBuilder<OutT> withKafkaProducerPoolSize(int poolSize)
poolSize
- Overwrite default KafkaProducers pool size. The default is 5.public KafkaEgressBuilder<OutT> withExactlyOnceProducerSemantics(java.time.Duration transactionTimeoutDuration)
With exactly-once producer semantics, users must also specify the transaction timeout. Note
that this value must not be larger than the transaction.max.timeout.ms
value configured
on Kafka brokers (by default, this is 15 minutes).
transactionTimeoutDuration
- the transaction timeout.public KafkaEgressBuilder<OutT> withAtLeastOnceProducerSemantics()
public KafkaEgressBuilder<OutT> withNoProducerSemantics()
public KafkaEgressBuilder<OutT> withProducerSemantic(KafkaProducerSemantic producerSemantic)
public KafkaEgressSpec<OutT> build()
EgressSpec
that can be used in a StatefulFunctionModule
.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.