Class KafkaFluxFactory<K,​V>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String AUTO_COMMIT_INTERVAL_MS_CONFIG
      Reactor takes control of offset committing by disabling the native Kafka auto commit and periodically committing offsets of acknowledged Records.
      static String BLOCK_REQUEST_ON_PARTITION_ASSIGNMENT_CONFIG
      Subscribers may want to block request Threads on assignment of partitions AND subsequent fetching/updating of offset positions on those partitions such that all imminently produced Records to the subscribed Topics will be received by the associated Consumer Group.
      static String CLOSE_TIMEOUT_CONFIG
      Closing the underlying Kafka Consumer is a fallible process.
      static String MAX_COMMIT_ATTEMPTS_CONFIG
      Committing Offsets can fail for retriable reasons.
      static String POLL_TIMEOUT_CONFIG
      Reactor allows controlling the timeout of its polls to Kafka.
    • Constructor Summary

      Constructors 
      Constructor Description
      KafkaFluxFactory​(com.expediagroup.rhapsody.kafka.factory.KafkaConfigFactory configFactory)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>> receive​(Collection<String> topics)  
      reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>> receive​(Collection<String> topics, ReceiverAcknowledgementStrategy acknowledgementStrategy)  
      reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>> receiveAuto​(Collection<String> topics, com.expediagroup.rhapsody.core.transformer.AutoAcknowledgementConfig autoAcknowledgementConfig)  
      reactor.core.publisher.Flux<reactor.core.publisher.GroupedFlux<org.apache.kafka.common.TopicPartition,​org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>> receiveAutoGroup​(Collection<String> topics, com.expediagroup.rhapsody.core.transformer.AutoAcknowledgementConfig autoAcknowledgementConfig, Function<? super reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>,​? extends org.reactivestreams.Publisher<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>> pregroup)  
      reactor.core.publisher.Flux<reactor.core.publisher.GroupedFlux<org.apache.kafka.common.TopicPartition,​com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>>> receiveGroup​(Collection<String> topics, ReceiverAcknowledgementStrategy acknowledgementStrategy, Function<? super reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>>,​? extends org.reactivestreams.Publisher<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>>> pregroup)  
    • Field Detail

      • POLL_TIMEOUT_CONFIG

        public static final String POLL_TIMEOUT_CONFIG
        Reactor allows controlling the timeout of its polls to Kafka. This config can be increased if the Kafka cluster is slow to respond. Specified as ISO-8601 Duration e.g. PT10S
        See Also:
        Constant Field Values
      • CLOSE_TIMEOUT_CONFIG

        public static final String CLOSE_TIMEOUT_CONFIG
        Closing the underlying Kafka Consumer is a fallible process. In order to not infinitely deadlock a Consumer during this process (which can lead to non-consumption of assigned partitions), we use a default equal to what's used in KafkaConsumer::close
        See Also:
        Constant Field Values
      • AUTO_COMMIT_INTERVAL_MS_CONFIG

        public static final String AUTO_COMMIT_INTERVAL_MS_CONFIG
        Reactor takes control of offset committing by disabling the native Kafka auto commit and periodically committing offsets of acknowledged Records. Since the native auto-commit is disabled, we are reusing the native property used to configure offset commit intervals.
        See Also:
        Constant Field Values
      • MAX_COMMIT_ATTEMPTS_CONFIG

        public static final String MAX_COMMIT_ATTEMPTS_CONFIG
        Committing Offsets can fail for retriable reasons. This config can be increased if failing to commit offsets is found to be particularly frequent
        See Also:
        Constant Field Values
      • BLOCK_REQUEST_ON_PARTITION_ASSIGNMENT_CONFIG

        public static final String BLOCK_REQUEST_ON_PARTITION_ASSIGNMENT_CONFIG
        Subscribers may want to block request Threads on assignment of partitions AND subsequent fetching/updating of offset positions on those partitions such that all imminently produced Records to the subscribed Topics will be received by the associated Consumer Group. This can help avoid timing problems, particularly with tests, and avoids having to use `auto.offset.reset = "earliest"` to guarantee receipt of Records immediately produced by the request Thread (directly or indirectly)
        See Also:
        Constant Field Values
    • Constructor Detail

      • KafkaFluxFactory

        public KafkaFluxFactory​(com.expediagroup.rhapsody.kafka.factory.KafkaConfigFactory configFactory)
    • Method Detail

      • receiveAutoGroup

        public reactor.core.publisher.Flux<reactor.core.publisher.GroupedFlux<org.apache.kafka.common.TopicPartition,​org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>> receiveAutoGroup​(Collection<String> topics,
                                                                                                                                                                                                          com.expediagroup.rhapsody.core.transformer.AutoAcknowledgementConfig autoAcknowledgementConfig,
                                                                                                                                                                                                          Function<? super reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>,​? extends org.reactivestreams.Publisher<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>> pregroup)
      • receiveAuto

        public reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>> receiveAuto​(Collection<String> topics,
                                                                                                                    com.expediagroup.rhapsody.core.transformer.AutoAcknowledgementConfig autoAcknowledgementConfig)
      • receiveGroup

        public reactor.core.publisher.Flux<reactor.core.publisher.GroupedFlux<org.apache.kafka.common.TopicPartition,​com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>>> receiveGroup​(Collection<String> topics,
                                                                                                                                                                                                                                                     ReceiverAcknowledgementStrategy acknowledgementStrategy,
                                                                                                                                                                                                                                                     Function<? super reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>>,​? extends org.reactivestreams.Publisher<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>>> pregroup)
      • receive

        public reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>> receive​(Collection<String> topics)
      • receive

        public reactor.core.publisher.Flux<com.expediagroup.rhapsody.api.Acknowledgeable<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>>> receive​(Collection<String> topics,
                                                                                                                                                               ReceiverAcknowledgementStrategy acknowledgementStrategy)