@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> org.apache.kafka.clients.producer.Producer<K,V> |
getProducer(String channel)
Gets the managed Kafka Producer for the given channel.
|
public <K,V> KafkaConsumer<K,V> getConsumer(String channel)
KafkaClientService
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.
getConsumer
in interface KafkaClientService
K
- the type of the keyV
- the type of the valuechannel
- the channel, must not be null
null
if not foundpublic <K,V> org.apache.kafka.clients.producer.Producer<K,V> getProducer(String channel)
KafkaClientService
getProducer
in interface KafkaClientService
K
- the type of the keyV
- the type of the valuechannel
- the channel, must not be null
null
if not foundCopyright © 2018–2021 SmallRye. All rights reserved.