Class KafkaSenderFactory<K,V>
- java.lang.Object
-
- com.expediagroup.rhapsody.kafka.factory.KafkaSenderFactory<K,V>
-
- Direct Known Subclasses:
KafkaValueSenderFactory
public class KafkaSenderFactory<K,V> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringHEADERS_ENABLED_CONFIGEnables headers to be serialized on outbound ProduerRecords.static StringMAX_IN_FLIGHT_CONFIGDeprecated.static StringMAX_IN_FLIGHT_PER_SEND_CONFIGThis is the maximum number of "in-flight" Records per sent Publisher.static StringRESUBSCRIBE_ON_ERROR_CONFIGFor sent Publishers, this configures whether or not Publishers are immediately resubscribed to in the event of an error.static StringSTOP_ON_ERROR_CONFIGUpon occurrence of synchronous Exceptions (i.e.
-
Constructor Summary
Constructors Constructor Description KafkaSenderFactory(com.expediagroup.rhapsody.kafka.factory.KafkaConfigFactory configFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Function<org.reactivestreams.Publisher<org.apache.kafka.clients.producer.ProducerRecord<K,V>>,reactor.core.publisher.Flux<reactor.kafka.sender.SenderResult<V>>>send()reactor.core.publisher.Flux<reactor.kafka.sender.SenderResult<V>>send(org.reactivestreams.Publisher<org.apache.kafka.clients.producer.ProducerRecord<K,V>> producerRecords)Function<org.reactivestreams.Publisher<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.producer.ProducerRecord<K,V>>>,reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<reactor.kafka.sender.SenderResult<V>>>>sendAcknowledgeable()reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<reactor.kafka.sender.SenderResult<V>>>sendAcknowledgeable(org.reactivestreams.Publisher<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.producer.ProducerRecord<K,V>>> acknowledgeables)
-
-
-
Field Detail
-
MAX_IN_FLIGHT_CONFIG
@Deprecated public static final String MAX_IN_FLIGHT_CONFIG
Deprecated.- See Also:
- Constant Field Values
-
MAX_IN_FLIGHT_PER_SEND_CONFIG
public static final String MAX_IN_FLIGHT_PER_SEND_CONFIG
This is the maximum number of "in-flight" Records per sent Publisher. Note that this is different from ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, which controls the total number of in-flight Requests for all sent Publishers on a Sender/Producer. It is important to note that if this is greater than 1 and a fatal error/cancellation occurs, the SenderResults of other in-flight Records will NOT be delivered downstream, removing the ability to execute auxiliary tasks on those Results, i.e. recovery from error or execution of acknowledgement- See Also:
- Constant Field Values
-
HEADERS_ENABLED_CONFIG
public static final String HEADERS_ENABLED_CONFIG
Enables headers to be serialized on outbound ProduerRecords. Defaults to false as this helps work around issues of pre-0.11.0.0 Kafka Client users and/or usage with Kafka Brokers/Topics that use `log.message.format.version` earlier than 0.11.0.0. Defaulting to false also helps to not break backward compatibility.- See Also:
- Constant Field Values
-
STOP_ON_ERROR_CONFIG
public static final String STOP_ON_ERROR_CONFIG
Upon occurrence of synchronous Exceptions (i.e. serialization), sent Publishers are immediately fatally errored/canceled. Upon asynchronous Exceptions (i.e. network issue), Reactor allows configuring whether or not to "stop" (aka error-out) the sent Publisher. Therefore, if this is disabled, there can be slightly different behavior for synchronous vs. asynchronous Exceptions. Most commonly, with non-singleton Publishers and with Error Resubscription enabled, the difference in behavior is directly related to the max number of in-flight Records, i.e. if the max in-flight Records is 1, there is no difference between this being enabled or disabled. If the max in-flight messages is greater than 1, other in-flight SenderResults may not be delivered downstream if this is enabled.- See Also:
- Constant Field Values
-
RESUBSCRIBE_ON_ERROR_CONFIG
public static final String RESUBSCRIBE_ON_ERROR_CONFIG
For sent Publishers, this configures whether or not Publishers are immediately resubscribed to in the event of an error. Enabled by default, and mostly useful for infinite streams.- See Also:
- Constant Field Values
-
-
Method Detail
-
sendAcknowledgeable
public Function<org.reactivestreams.Publisher<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.producer.ProducerRecord<K,V>>>,reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<reactor.kafka.sender.SenderResult<V>>>> sendAcknowledgeable()
-
sendAcknowledgeable
public reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<reactor.kafka.sender.SenderResult<V>>> sendAcknowledgeable(org.reactivestreams.Publisher<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.producer.ProducerRecord<K,V>>> acknowledgeables)
-
send
public Function<org.reactivestreams.Publisher<org.apache.kafka.clients.producer.ProducerRecord<K,V>>,reactor.core.publisher.Flux<reactor.kafka.sender.SenderResult<V>>> send()
-
-