Class ReactiveKafkaShareConsumer<K,V>

java.lang.Object
io.smallrye.reactive.messaging.kafka.impl.ReactiveKafkaShareConsumer<K,V>
All Implemented Interfaces:
KafkaShareConsumer<K,V>

public class ReactiveKafkaShareConsumer<K,V> extends Object implements KafkaShareConsumer<K,V>
  • Constructor Details

  • Method Details

    • withConsumerOnPollingThread

      public io.smallrye.mutiny.Uni<org.apache.kafka.clients.consumer.ShareConsumer<K,V>> withConsumerOnPollingThread()
    • getShareGroup

      public String getShareGroup()
    • getClientId

      public String getClientId()
    • runOnPollingThread

      @CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> runOnPollingThread(Function<org.apache.kafka.clients.consumer.ShareConsumer<K,V>,T> action)
      Description copied from interface: KafkaShareConsumer
      Runs an action on the polling thread.

      The action is a function taking as parameter the KafkaShareConsumer and that returns a result (potentially null). The produced Uni emits the returned result when the action completes. If the action throws an exception, the produced Uni emits the exception as failure.

      If the action does not return a result, use KafkaShareConsumer.runOnPollingThread(java.util.function.Consumer).

      Specified by:
      runOnPollingThread in interface KafkaShareConsumer<K,V>
      Type Parameters:
      T - the type of result, can be Void
      Parameters:
      action - the action to execute, must not be null
      Returns:
      the Uni emitting the result or the failure when the action completes.
    • runOnPollingThread

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> runOnPollingThread(Consumer<org.apache.kafka.clients.consumer.ShareConsumer<K,V>> action)
      Description copied from interface: KafkaShareConsumer
      Runs an action on the polling thread.

      The action is a consumer receiving the KafkaShareConsumer. The produced Uni emits null when the action completes. If the action throws an exception, the produced Uni emits the exception as failure.

      Specified by:
      runOnPollingThread in interface KafkaShareConsumer<K,V>
      Parameters:
      action - the action, must not be null
      Returns:
      the Uni emitting null or the failure when the action completes.
    • subscribe

      @CheckReturnValue public io.smallrye.mutiny.Multi<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> subscribe(Set<String> topics)
    • subscribeBatch

      @CheckReturnValue public io.smallrye.mutiny.Multi<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>> subscribeBatch(Set<String> topics)
    • createDeserializationFailureHandler

      public static <T> DeserializationFailureHandler<T> createDeserializationFailureHandler(boolean isKey, jakarta.enterprise.inject.Instance<DeserializationFailureHandler<?>> deserializationFailureHandlers, KafkaConnectorIncomingConfiguration configuration)
    • get

      public String get(String attribute)
    • unwrap

      public org.apache.kafka.clients.consumer.ShareConsumer<K,V> unwrap()
      Specified by:
      unwrap in interface KafkaShareConsumer<K,V>
      Returns:
      the underlying share consumer. Be aware that to use it you needs to be on the polling thread.
    • commit

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> commit()
      Description copied from interface: KafkaShareConsumer
      Commits the offsets
      Specified by:
      commit in interface KafkaShareConsumer<K,V>
      Returns:
      the Uni emitting null when the commit has been executed.
    • commitAsync

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> commitAsync()
      Description copied from interface: KafkaShareConsumer
      Commits the offsets asynchronously
      Specified by:
      commitAsync in interface KafkaShareConsumer<K,V>
      Returns:
      the Uni emitting null when the commit has been executed.
    • acknowledge

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> acknowledge(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
      Specified by:
      acknowledge in interface KafkaShareConsumer<K,V>
      Returns:
    • acknowledge

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> acknowledge(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record, org.apache.kafka.clients.consumer.AcknowledgeType type)
      Specified by:
      acknowledge in interface KafkaShareConsumer<K,V>
    • configuration

      public Map<String,?> configuration()
      Specified by:
      configuration in interface KafkaShareConsumer<K,V>
      Returns:
      Kafka share consumer configuration
    • close

      public void close()