@ApplicationScoped public class KafkaClientServiceImpl extends Object implements KafkaClientService
| Constructor and Description |
|---|
KafkaClientServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
<K,V> KafkaConsumer<K,V> |
getConsumer(String channel)
Gets the managed Kafka Consumer for the given channel.
|
<K,V> KafkaProducer<K,V> |
getProducer(String channel)
Gets the managed Kafka Producer for the given channel.
|
public <K,V> KafkaConsumer<K,V> getConsumer(String channel)
KafkaClientServiceBe 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.
getConsumer in interface KafkaClientServiceK - the type of the keyV - the type of the valuechannel - the channel, must not be nullnull if not foundpublic <K,V> KafkaProducer<K,V> getProducer(String channel)
KafkaClientServiceBe 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.
getProducer in interface KafkaClientServiceK - the type of the keyV - the type of the valuechannel - the channel, must not be nullnull if not foundCopyright © 2018–2021 SmallRye. All rights reserved.