Package org.eso.ias.command.kafka
Class ReplyKafkaConsumer
java.lang.Object
org.eso.ias.kafkautils.KafkaStringsConsumer
org.eso.ias.kafkautils.SimpleStringConsumer
org.eso.ias.command.kafka.ReplyKafkaConsumer
- All Implemented Interfaces:
Runnable
,org.apache.kafka.clients.consumer.ConsumerRebalanceListener
,KafkaStringsConsumer.StringsConsumer
,SimpleStringConsumer.KafkaConsumerListener
public class ReplyKafkaConsumer
extends SimpleStringConsumer
implements SimpleStringConsumer.KafkaConsumerListener
An helper class to easily consume replies from the kafka reply topic.
The object must be initialized invoking
KafkaStringsConsumer.setUp()
before starting to get replies.
Once terminated, KafkaStringsConsumer.tearDown()
must be invoked.-
Nested Class Summary
Nested classes/interfaces inherited from class org.eso.ias.kafkautils.SimpleStringConsumer
SimpleStringConsumer.KafkaConsumerListener
Nested classes/interfaces inherited from class org.eso.ias.kafkautils.KafkaStringsConsumer
KafkaStringsConsumer.StreamPosition, KafkaStringsConsumer.StringsConsumer
-
Field Summary
Fields inherited from class org.eso.ias.kafkautils.KafkaStringsConsumer
DEFAULT_CONSUMER_READY_TIMEOUT, MIN_CONSUMER_READY_TIMEOUT, topicName, WAIT_CONSUMER_READY_TIMEOUT_PROP_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
startGettingReplies
(KafkaStringsConsumer.StreamPosition startReadingFrom, ReplyListener listener) Start getting events from the repluy topicvoid
stringEventReceived
(String event) A string has bene received from the reply topicMethods inherited from class org.eso.ias.kafkautils.SimpleStringConsumer
getNumOfProcessedStrings, startGettingStrings, stringsReceived
Methods inherited from class org.eso.ias.kafkautils.KafkaStringsConsumer
getNumOfProcessedRecords, isReady, onPartitionsAssigned, onPartitionsLost, onPartitionsRevoked, run, seekTo, setUp, setUp, startGettingEvents, tearDown, waitUntilConsumerReady
-
Constructor Details
-
ReplyKafkaConsumer
Constructor- Parameters:
brokers
- Kafka brokersreplyConsumerId
- The id of the consumer
-
-
Method Details
-
stringEventReceived
A string has bene received from the reply topic- Specified by:
stringEventReceived
in interfaceSimpleStringConsumer.KafkaConsumerListener
- Parameters:
event
- The string received in the topic- See Also:
-
startGettingReplies
public void startGettingReplies(KafkaStringsConsumer.StreamPosition startReadingFrom, ReplyListener listener) throws KafkaUtilsException Start getting events from the repluy topic- Parameters:
startReadingFrom
- Starting position in the kafka partitionlistener
- The listener of events published in the topic- Throws:
KafkaUtilsException
- in case of timeout subscribing to the kafkatopic
-