Class KafkaRequestReplyImpl<Req,Rep>
java.lang.Object
io.smallrye.reactive.messaging.providers.extension.AbstractEmitter<T>
io.smallrye.reactive.messaging.providers.extension.MutinyEmitterImpl<Req>
io.smallrye.reactive.messaging.kafka.reply.KafkaRequestReplyImpl<Req,Rep>
- All Implemented Interfaces:
io.smallrye.mutiny.subscription.MultiSubscriber<KafkaRecord<?,,Rep>> io.smallrye.reactive.messaging.EmitterType,KafkaRequestReply<Req,,Rep> io.smallrye.reactive.messaging.MessagePublisherProvider<Req>,io.smallrye.reactive.messaging.MutinyEmitter<Req>,Flow.Subscriber<KafkaRecord<?,Rep>>
@Experimental("Experimental API")
public class KafkaRequestReplyImpl<Req,Rep>
extends MutinyEmitterImpl<Req>
implements KafkaRequestReply<Req,Rep>, io.smallrye.mutiny.subscription.MultiSubscriber<KafkaRecord<?,Rep>>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class io.smallrye.reactive.messaging.providers.extension.AbstractEmitter
internal, name, NO_SUBSCRIBER_EXCEPTION, publisher, synchronousFailureFields inherited from interface io.smallrye.reactive.messaging.kafka.reply.KafkaRequestReply
DEFAULT_CORRELATION_ID_HANDLER, DEFAULT_REPLIES_TOPIC_SUFFIX, DEFAULT_REPLY_CORRELATION_ID_HEADER, DEFAULT_REPLY_PARTITION_HEADER, DEFAULT_REPLY_TOPIC_HEADER, REPLY_CORRELATION_ID_HANDLER_KEY, REPLY_CORRELATION_ID_HEADER_KEY, REPLY_FAILURE_HANDLER_KEY, REPLY_PARTITION_HEADER_KEY, REPLY_PARTITION_KEY, REPLY_TIMEOUT_KEY, REPLY_TOPIC_HEADER_KEY, REPLY_TOPIC_KEY -
Constructor Summary
ConstructorsConstructorDescriptionKafkaRequestReplyImpl(io.smallrye.reactive.messaging.EmitterConfiguration config, long defaultBufferSize, org.eclipse.microprofile.config.Config channelConfiguration, jakarta.enterprise.inject.Instance<Map<String, Object>> configurations, io.vertx.mutiny.core.Vertx vertx, KafkaCDIEvents kafkaCDIEvents, jakarta.enterprise.inject.Instance<io.opentelemetry.api.OpenTelemetry> openTelemetryInstance, jakarta.enterprise.inject.Instance<KafkaCommitHandler.Factory> commitHandlerFactory, jakarta.enterprise.inject.Instance<KafkaFailureHandler.Factory> failureHandlerFactories, jakarta.enterprise.inject.Instance<io.smallrye.reactive.messaging.ClientCustomizer<Map<String, Object>>> configCustomizers, jakarta.enterprise.inject.Instance<DeserializationFailureHandler<?>> deserializationFailureHandlers, jakarta.enterprise.inject.Instance<CorrelationIdHandler> correlationIdHandlers, jakarta.enterprise.inject.Instance<ReplyFailureHandler> replyFailureHandlers, jakarta.enterprise.inject.Instance<KafkaConsumerRebalanceListener> rebalanceListeners) -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Sends the completion event to the channel indicating that no other events will be sent afterward.KafkaConsumer<?,Rep> Retrieves the Kafka Consumer used for consuming messages.Retrieves the pending replies for each topic.Flow.Publisher<org.eclipse.microprofile.reactive.messaging.Message<? extends Req>>voidvoidvoidonItem(KafkaRecord<?, Rep> record) voidonSubscribe(Flow.Subscription subscription) io.smallrye.mutiny.Uni<org.eclipse.microprofile.reactive.messaging.Message<Rep>>Sends a request and receives a response.io.smallrye.mutiny.Uni<Rep>Sends a request and receives a response.io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>>Blocks until the consumer has been assigned all partitions for consumption.io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>>waitForAssignments(Collection<org.apache.kafka.common.TopicPartition> topicPartitions) Blocks until the consumer has been assigned given partitions for consumption.Methods inherited from class io.smallrye.reactive.messaging.providers.extension.MutinyEmitterImpl
send, send, sendAndAwait, sendAndForget, sendMessage, sendMessageAndAwait, sendMessageAndForgetMethods inherited from class io.smallrye.reactive.messaging.providers.extension.AbstractEmitter
emit, error, hasRequests, isCancelled, verifyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.smallrye.mutiny.subscription.MultiSubscriber
onComplete, onError, onNextMethods inherited from interface io.smallrye.reactive.messaging.MutinyEmitter
error, hasRequests, isCancelled
-
Constructor Details
-
KafkaRequestReplyImpl
public KafkaRequestReplyImpl(io.smallrye.reactive.messaging.EmitterConfiguration config, long defaultBufferSize, org.eclipse.microprofile.config.Config channelConfiguration, jakarta.enterprise.inject.Instance<Map<String, Object>> configurations, io.vertx.mutiny.core.Vertx vertx, KafkaCDIEvents kafkaCDIEvents, jakarta.enterprise.inject.Instance<io.opentelemetry.api.OpenTelemetry> openTelemetryInstance, jakarta.enterprise.inject.Instance<KafkaCommitHandler.Factory> commitHandlerFactory, jakarta.enterprise.inject.Instance<KafkaFailureHandler.Factory> failureHandlerFactories, jakarta.enterprise.inject.Instance<io.smallrye.reactive.messaging.ClientCustomizer<Map<String, Object>>> configCustomizers, jakarta.enterprise.inject.Instance<DeserializationFailureHandler<?>> deserializationFailureHandlers, jakarta.enterprise.inject.Instance<CorrelationIdHandler> correlationIdHandlers, jakarta.enterprise.inject.Instance<ReplyFailureHandler> replyFailureHandlers, jakarta.enterprise.inject.Instance<KafkaConsumerRebalanceListener> rebalanceListeners)
-
-
Method Details
-
getPublisher
public Flow.Publisher<org.eclipse.microprofile.reactive.messaging.Message<? extends Req>> getPublisher()- Specified by:
getPublisherin interfaceio.smallrye.reactive.messaging.MessagePublisherProvider<Req>- Overrides:
getPublisherin classAbstractEmitter<Req>
-
complete
public void complete()Description copied from interface:KafkaRequestReplySends the completion event to the channel indicating that no other events will be sent afterward.- Specified by:
completein interfaceKafkaRequestReply<Req,Rep> - Specified by:
completein interfaceio.smallrye.reactive.messaging.MutinyEmitter<Req>- Overrides:
completein classAbstractEmitter<Req>
-
request
Description copied from interface:KafkaRequestReplySends a request and receives a response.- Specified by:
requestin interfaceKafkaRequestReply<Req,Rep> - Parameters:
request- the request object to be sent- Returns:
- a Uni object representing the result of the send and receive operation
-
request
public io.smallrye.mutiny.Uni<org.eclipse.microprofile.reactive.messaging.Message<Rep>> request(org.eclipse.microprofile.reactive.messaging.Message<Req> request) Description copied from interface:KafkaRequestReplySends a request and receives a response.- Specified by:
requestin interfaceKafkaRequestReply<Req,Rep> - Parameters:
request- the request object to be sent- Returns:
- a Uni object representing the result of the send and receive operation
-
waitForAssignments
Description copied from interface:KafkaRequestReplyBlocks until the consumer has been assigned all partitions for consumption. If areply.partitionis provided, waits only for the assignment of that particular partition. Otherwise, does a lookup for topic partitions and waits for the assignment of all partitions.- Specified by:
waitForAssignmentsin interfaceKafkaRequestReply<Req,Rep> - Returns:
- a Uni object that resolves to a Set of TopicPartition once the assignments have been made.
-
waitForAssignments
public io.smallrye.mutiny.Uni<Set<org.apache.kafka.common.TopicPartition>> waitForAssignments(Collection<org.apache.kafka.common.TopicPartition> topicPartitions) Description copied from interface:KafkaRequestReplyBlocks until the consumer has been assigned given partitions for consumption.- Specified by:
waitForAssignmentsin interfaceKafkaRequestReply<Req,Rep> - Parameters:
topicPartitions- the number of partitions to wait for assignments- Returns:
- a Uni object that resolves to a Set of TopicPartition once the assignments have been made.
-
getPendingReplies
Description copied from interface:KafkaRequestReplyRetrieves the pending replies for each topic.- Specified by:
getPendingRepliesin interfaceKafkaRequestReply<Req,Rep> - Returns:
- a map containing the pending replies for each topic. The map's keys are the topic names and the values are instances of PendingReply.
-
getConsumer
Description copied from interface:KafkaRequestReplyRetrieves the Kafka Consumer used for consuming messages.- Specified by:
getConsumerin interfaceKafkaRequestReply<Req,Rep> - Returns:
- the Kafka Consumer used for consuming messages.
-
onSubscribe
- Specified by:
onSubscribein interfaceFlow.Subscriber<Req>
-
onItem
- Specified by:
onItemin interfaceio.smallrye.mutiny.subscription.MultiSubscriber<Req>
-
onFailure
- Specified by:
onFailurein interfaceio.smallrye.mutiny.subscription.MultiSubscriber<Req>
-
onCompletion
public void onCompletion()- Specified by:
onCompletionin interfaceio.smallrye.mutiny.subscription.MultiSubscriber<Req>
-