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 <K,V>
KafkaConsumer<K,V>getConsumer(String channel)
Gets the managed Kafka Consumer for the given channel.Set<String>
getConsumerChannels()
Get the names of all the Kafka incoming channels managed by this connector.<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.
-
-
-
Method Detail
-
getConsumer
public <K,V> KafkaConsumer<K,V> getConsumer(String channel)
Description copied from interface:KafkaClientService
Gets the managed Kafka Consumer for the given channel. This method returns the reactive consumer.Be aware that most actions requires to be run on the Kafka polling thread. You can schedule actions using:
getConsumer(channel).runOnPollingThread(c -> { ... })
You can retrieve the low-level client using the
KafkaConsumer.unwrap()
method.- Specified by:
getConsumer
in interfaceKafkaClientService
- Type Parameters:
K
- the type of the keyV
- the type of the value- Parameters:
channel
- the channel, must not benull
- Returns:
- the consumer,
null
if not found
-
getProducer
public <K,V> KafkaProducer<K,V> getProducer(String channel)
Description copied from interface:KafkaClientService
Gets 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:
getProducer
in interfaceKafkaClientService
- Type Parameters:
K
- the type of the keyV
- the type of the value- Parameters:
channel
- the channel, must not benull
- Returns:
- the producer,
null
if not found
-
getConsumerChannels
public Set<String> getConsumerChannels()
Description copied from interface:KafkaClientService
Get the names of all the Kafka incoming channels managed by this connector.- Specified by:
getConsumerChannels
in interfaceKafkaClientService
- Returns:
- the names of the Kafka consumer incoming channels.
-
getProducerChannels
public Set<String> getProducerChannels()
Description copied from interface:KafkaClientService
Get the names of all the Kafka outgoing channels managed by this connector.- Specified by:
getProducerChannels
in interfaceKafkaClientService
- Returns:
- the names of the Kafka producer outgoing channels.
-
-