Class TracingKafkaReceiver<K,V>

java.lang.Object
org.springframework.cloud.sleuth.instrument.kafka.TracingKafkaReceiver<K,V>
All Implemented Interfaces:
reactor.kafka.receiver.KafkaReceiver<K,V>

public class TracingKafkaReceiver<K,V> extends Object implements reactor.kafka.receiver.KafkaReceiver<K,V>
Decorator for KafkaReceiver that delegates most of the work back to original consumer, but returns publishers decorated with tracing context per each element.
Author:
Maciej GromuĊ‚
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    TracingKafkaReceiver(ReactiveKafkaTracingPropagator reactiveKafkaTracingPropagator, reactor.kafka.receiver.KafkaReceiver<K,V> delegate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <K, V> reactor.kafka.receiver.KafkaReceiver<K,V>
    create(ReactiveKafkaTracingPropagator reactiveKafkaTracingPropagator, reactor.kafka.receiver.internals.ConsumerFactory factory, reactor.kafka.receiver.ReceiverOptions<K,V> options)
    Creates KafkaReceiver that will de decorated by tracing propagator to provide kafka consumer publishing elements containing tracing context in their reactor context.
    static <K, V> reactor.kafka.receiver.KafkaReceiver<K,V>
    create(ReactiveKafkaTracingPropagator reactiveKafkaTracingPropagator, reactor.kafka.receiver.ReceiverOptions<K,V> options)
    Creates KafkaReceiver that will de decorated by tracing propagator to provide kafka consumer publishing elements containing tracing context in their reactor context.
    <T> reactor.core.publisher.Mono<T>
    doOnConsumer(Function<org.apache.kafka.clients.consumer.Consumer<K,V>,? extends T> function)
     
    reactor.core.publisher.Flux<reactor.kafka.receiver.ReceiverRecord<K,V>>
     
    reactor.core.publisher.Flux<reactor.kafka.receiver.ReceiverRecord<K,V>>
    receive(Integer prefetch)
     
    reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>
     
    reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>
     
    reactor.core.publisher.Flux<reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>>
     
    reactor.core.publisher.Flux<reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>>
     
    reactor.core.publisher.Flux<reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>>
    receiveExactlyOnce(reactor.kafka.sender.TransactionManager transactionManager, Integer prefetch)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface reactor.kafka.receiver.KafkaReceiver

    receiveExactlyOnce
  • Constructor Details

    • TracingKafkaReceiver

      public TracingKafkaReceiver(ReactiveKafkaTracingPropagator reactiveKafkaTracingPropagator, reactor.kafka.receiver.KafkaReceiver<K,V> delegate)
  • Method Details

    • create

      public static <K, V> reactor.kafka.receiver.KafkaReceiver<K,V> create(ReactiveKafkaTracingPropagator reactiveKafkaTracingPropagator, reactor.kafka.receiver.ReceiverOptions<K,V> options)
      Creates KafkaReceiver that will de decorated by tracing propagator to provide kafka consumer publishing elements containing tracing context in their reactor context.
      Type Parameters:
      K - Key of the record
      V - Value of the record
      Parameters:
      reactiveKafkaTracingPropagator - Instance of trace propagation decorator. Should be available in spring application context as a bean.
      options - Options to pass for underlying KafkaReceiver.create(ReceiverOptions)
    • create

      public static <K, V> reactor.kafka.receiver.KafkaReceiver<K,V> create(ReactiveKafkaTracingPropagator reactiveKafkaTracingPropagator, reactor.kafka.receiver.internals.ConsumerFactory factory, reactor.kafka.receiver.ReceiverOptions<K,V> options)
      Creates KafkaReceiver that will de decorated by tracing propagator to provide kafka consumer publishing elements containing tracing context in their reactor context.
      Type Parameters:
      K - Key of the record
      V - Value of the record
      Parameters:
      reactiveKafkaTracingPropagator - Instance of trace propagation decorator. Should be available in spring application context as a bean.
      factory - Custom factory to provide for underlying KafkaReceiver.create(ConsumerFactory, ReceiverOptions)
      options - Options to provide for underlying KafkaReceiver.create(ConsumerFactory, ReceiverOptions)
    • receive

      public reactor.core.publisher.Flux<reactor.kafka.receiver.ReceiverRecord<K,V>> receive(Integer prefetch)
      Specified by:
      receive in interface reactor.kafka.receiver.KafkaReceiver<K,V>
    • receive

      public reactor.core.publisher.Flux<reactor.kafka.receiver.ReceiverRecord<K,V>> receive()
      Specified by:
      receive in interface reactor.kafka.receiver.KafkaReceiver<K,V>
    • receiveAutoAck

      public reactor.core.publisher.Flux<reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>> receiveAutoAck(Integer prefetch)
      Specified by:
      receiveAutoAck in interface reactor.kafka.receiver.KafkaReceiver<K,V>
    • receiveAutoAck

      public reactor.core.publisher.Flux<reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>> receiveAutoAck()
      Specified by:
      receiveAutoAck in interface reactor.kafka.receiver.KafkaReceiver<K,V>
    • receiveAtmostOnce

      public reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> receiveAtmostOnce(Integer prefetch)
      Specified by:
      receiveAtmostOnce in interface reactor.kafka.receiver.KafkaReceiver<K,V>
    • receiveAtmostOnce

      public reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> receiveAtmostOnce()
      Specified by:
      receiveAtmostOnce in interface reactor.kafka.receiver.KafkaReceiver<K,V>
    • receiveExactlyOnce

      public reactor.core.publisher.Flux<reactor.core.publisher.Flux<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>> receiveExactlyOnce(reactor.kafka.sender.TransactionManager transactionManager, Integer prefetch)
      Specified by:
      receiveExactlyOnce in interface reactor.kafka.receiver.KafkaReceiver<K,V>
    • doOnConsumer

      public <T> reactor.core.publisher.Mono<T> doOnConsumer(Function<org.apache.kafka.clients.consumer.Consumer<K,V>,? extends T> function)
      Specified by:
      doOnConsumer in interface reactor.kafka.receiver.KafkaReceiver<K,V>