Class ReactiveKafkaShareConsumer<K,V>
java.lang.Object
io.smallrye.reactive.messaging.kafka.impl.ReactiveKafkaShareConsumer<K,V>
- All Implemented Interfaces:
KafkaShareConsumer<K,V>
-
Constructor Summary
ConstructorsConstructorDescriptionReactiveKafkaShareConsumer(KafkaConnectorIncomingConfiguration config, jakarta.enterprise.inject.Instance<io.smallrye.reactive.messaging.ClientCustomizer<Map<String, Object>>> configCustomizers, jakarta.enterprise.inject.Instance<DeserializationFailureHandler<?>> deserializationFailureHandlers, String shareGroup, BiConsumer<Throwable, Boolean> reportFailure, io.vertx.core.Context context, Consumer<org.apache.kafka.clients.consumer.ShareConsumer<K, V>> onConsumerCreated) ReactiveKafkaShareConsumer(Map<String, Object> kafkaConfiguration, DeserializationFailureHandler<K> keyDeserializationFailureHandler, DeserializationFailureHandler<V> valueDeserializationFailureHandler, RuntimeKafkaSourceConfiguration config, boolean lazyClient, int pollTimeoutMs, boolean failOnDeserializationFailure, boolean cloudEventsEnabled, Consumer<org.apache.kafka.clients.consumer.ShareConsumer<K, V>> onConsumerCreated, BiConsumer<Throwable, Boolean> reportFailure, io.vertx.core.Context context) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Void> acknowledge(org.apache.kafka.clients.consumer.ConsumerRecord<K, V> record) io.smallrye.mutiny.Uni<Void> acknowledge(org.apache.kafka.clients.consumer.ConsumerRecord<K, V> record, org.apache.kafka.clients.consumer.AcknowledgeType type) voidclose()io.smallrye.mutiny.Uni<Void> commit()Commits the offsetsio.smallrye.mutiny.Uni<Void> Commits the offsets asynchronouslystatic <T> DeserializationFailureHandler<T> createDeserializationFailureHandler(boolean isKey, jakarta.enterprise.inject.Instance<DeserializationFailureHandler<?>> deserializationFailureHandlers, KafkaConnectorIncomingConfiguration configuration) io.smallrye.mutiny.Uni<Void> runOnPollingThread(Consumer<org.apache.kafka.clients.consumer.ShareConsumer<K, V>> action) Runs an action on the polling thread.<T> io.smallrye.mutiny.Uni<T> runOnPollingThread(Function<org.apache.kafka.clients.consumer.ShareConsumer<K, V>, T> action) Runs an action on the polling thread.subscribeBatch(Set<String> topics) unwrap()
-
Constructor Details
-
ReactiveKafkaShareConsumer
public ReactiveKafkaShareConsumer(KafkaConnectorIncomingConfiguration config, jakarta.enterprise.inject.Instance<io.smallrye.reactive.messaging.ClientCustomizer<Map<String, Object>>> configCustomizers, jakarta.enterprise.inject.Instance<DeserializationFailureHandler<?>> deserializationFailureHandlers, String shareGroup, BiConsumer<Throwable, Boolean> reportFailure, io.vertx.core.Context context, Consumer<org.apache.kafka.clients.consumer.ShareConsumer<K, V>> onConsumerCreated) -
ReactiveKafkaShareConsumer
public ReactiveKafkaShareConsumer(Map<String, Object> kafkaConfiguration, DeserializationFailureHandler<K> keyDeserializationFailureHandler, DeserializationFailureHandler<V> valueDeserializationFailureHandler, RuntimeKafkaSourceConfiguration config, boolean lazyClient, int pollTimeoutMs, boolean failOnDeserializationFailure, boolean cloudEventsEnabled, Consumer<org.apache.kafka.clients.consumer.ShareConsumer<K, V>> onConsumerCreated, BiConsumer<Throwable, Boolean> reportFailure, io.vertx.core.Context context)
-
-
Method Details
-
withConsumerOnPollingThread
-
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:KafkaShareConsumerRuns an action on the polling thread.The action is a function taking as parameter the
KafkaShareConsumerand that returns a result (potentiallynull). The producedUniemits the returned result when the action completes. If the action throws an exception, the producedUniemits the exception as failure.If the action does not return a result, use
KafkaShareConsumer.runOnPollingThread(java.util.function.Consumer).- Specified by:
runOnPollingThreadin interfaceKafkaShareConsumer<K,V> - Type Parameters:
T- the type of result, can beVoid- Parameters:
action- the action to execute, must not benull- 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:KafkaShareConsumerRuns an action on the polling thread.The action is a consumer receiving the
KafkaShareConsumer. The producedUniemitsnullwhen the action completes. If the action throws an exception, the producedUniemits the exception as failure.- Specified by:
runOnPollingThreadin interfaceKafkaShareConsumer<K,V> - Parameters:
action- the action, must not benull- Returns:
- the Uni emitting
nullor the failure when the action completes.
-
subscribe
-
subscribeBatch
-
createDeserializationFailureHandler
public static <T> DeserializationFailureHandler<T> createDeserializationFailureHandler(boolean isKey, jakarta.enterprise.inject.Instance<DeserializationFailureHandler<?>> deserializationFailureHandlers, KafkaConnectorIncomingConfiguration configuration) -
get
-
unwrap
- Specified by:
unwrapin interfaceKafkaShareConsumer<K,V> - Returns:
- the underlying share consumer. Be aware that to use it you needs to be on the polling thread.
-
commit
Description copied from interface:KafkaShareConsumerCommits the offsets- Specified by:
commitin interfaceKafkaShareConsumer<K,V> - Returns:
- the Uni emitting
nullwhen the commit has been executed.
-
commitAsync
Description copied from interface:KafkaShareConsumerCommits the offsets asynchronously- Specified by:
commitAsyncin interfaceKafkaShareConsumer<K,V> - Returns:
- the Uni emitting
nullwhen 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:
acknowledgein interfaceKafkaShareConsumer<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:
acknowledgein interfaceKafkaShareConsumer<K,V>
-
configuration
- Specified by:
configurationin interfaceKafkaShareConsumer<K,V> - Returns:
- Kafka share consumer configuration
-
close
public void close()
-