Class KafkaClientServiceImpl
- java.lang.Object
-
- io.smallrye.reactive.messaging.kafka.impl.KafkaClientServiceImpl
-
- All Implemented Interfaces:
KafkaClientService
@ApplicationScoped public class KafkaClientServiceImpl extends Object implements KafkaClientService
-
-
Constructor Summary
Constructors Constructor Description KafkaClientServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>getConsumerChannels()Get the names of all the Kafka incoming channels managed by this connector.<K,V>
List<KafkaConsumer<K,V>>getConsumers(String channel)Gets the list of managed Kafka Consumer for the given channel.<K,V>
KafkaProducer<K,V>getProducer(String channel)Gets the managed Kafka Producer for the given channel.Set<String>getProducerChannels()Get the names of all the Kafka outgoing channels managed by this connector.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.smallrye.reactive.messaging.kafka.KafkaClientService
getConsumer
-
-
-
-
Method Detail
-
getConsumers
public <K,V> List<KafkaConsumer<K,V>> getConsumers(String channel)
Description copied from interface:KafkaClientServiceGets the list of managed Kafka Consumer for the given channel. This method returns a reactive consumers, in the order of creation for multi-consumer channels.- Specified by:
getConsumersin interfaceKafkaClientService- Type Parameters:
K- the type of the keyV- the type of the value- Parameters:
channel- the channel, must not benull- Returns:
- the list of consumers, empty list if not found
-
getProducer
public <K,V> KafkaProducer<K,V> getProducer(String channel)
Description copied from interface:KafkaClientServiceGets the managed Kafka Producer for the given channel. This method returns the reactive producer.Be aware that most actions require to be run on the Kafka sending thread. You can schedule actions using:
getProducer(channel).runOnSendingThread(c -> { ... })You can retrieve the low-level client using the
KafkaProducer.unwrap()method.- Specified by:
getProducerin interfaceKafkaClientService- Type Parameters:
K- the type of the keyV- the type of the value- Parameters:
channel- the channel, must not benull- Returns:
- the producer,
nullif not found
-
getConsumerChannels
public Set<String> getConsumerChannels()
Description copied from interface:KafkaClientServiceGet the names of all the Kafka incoming channels managed by this connector.- Specified by:
getConsumerChannelsin interfaceKafkaClientService- Returns:
- the names of the Kafka consumer incoming channels.
-
getProducerChannels
public Set<String> getProducerChannels()
Description copied from interface:KafkaClientServiceGet the names of all the Kafka outgoing channels managed by this connector.- Specified by:
getProducerChannelsin interfaceKafkaClientService- Returns:
- the names of the Kafka producer outgoing channels.
-
-