Class KAFKAMessageListener
java.lang.Object
org.wso2.carbon.inbound.endpoint.protocol.kafka.AbstractKafkaMessageListener
org.wso2.carbon.inbound.endpoint.protocol.kafka.KAFKAMessageListener
-
Nested Class Summary
Nested classes/interfaces inherited from class org.wso2.carbon.inbound.endpoint.protocol.kafka.AbstractKafkaMessageListener
AbstractKafkaMessageListener.CONSUMER_TYPE -
Field Summary
Fields inherited from class org.wso2.carbon.inbound.endpoint.protocol.kafka.AbstractKafkaMessageListener
consumerConnector, consumerIte, injectHandler, kafkaProperties, log, threadCount, topics -
Constructor Summary
ConstructorsConstructorDescriptionKAFKAMessageListener(int threadCount, List<String> topics, Properties kafkaProperties, InjectHandler injectHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoidconsumeMultipleTopics(String name) Consume from multiple topicsbooleanCreate the connection with the zookeeper to consume the messagesbooleanUsed to check whether there are multiple topics to consume frombooleanhasNext()Check ConsumerIterator whether It has next valuebooleanhasNext(kafka.consumer.ConsumerIterator<byte[], byte[]> consumerIterator) voidinjectMessageToESB(String name) Poll the messages from the zookeeper and injected to the sequencevoidinjectMessageToESB(String sequenceName, kafka.consumer.ConsumerIterator<byte[], byte[]> consumerIterator) voidstart()Starts topics consuming the messages,the message can be consumed by topic or topic filter which are white list and black list.protected voidstartConsumers(List<kafka.consumer.KafkaStream<byte[], byte[]>> streams) Use one stream from kafka stream iteratorMethods inherited from class org.wso2.carbon.inbound.endpoint.protocol.kafka.AbstractKafkaMessageListener
destroy
-
Constructor Details
-
KAFKAMessageListener
public KAFKAMessageListener(int threadCount, List<String> topics, Properties kafkaProperties, InjectHandler injectHandler) throws Exception - Throws:
Exception
-
-
Method Details
-
createKafkaConsumerConnector
Create the connection with the zookeeper to consume the messages- Specified by:
createKafkaConsumerConnectorin classAbstractKafkaMessageListener- Throws:
Exception
-
start
Starts topics consuming the messages,the message can be consumed by topic or topic filter which are white list and black list.- Specified by:
startin classAbstractKafkaMessageListener- Throws:
Exception
-
startConsumers
Use one stream from kafka stream iterator- Parameters:
streams-
-
injectMessageToESB
Description copied from class:AbstractKafkaMessageListenerPoll the messages from the zookeeper and injected to the sequence- Specified by:
injectMessageToESBin classAbstractKafkaMessageListener
-
injectMessageToESB
public void injectMessageToESB(String sequenceName, kafka.consumer.ConsumerIterator<byte[], byte[]> consumerIterator) -
hasNext
public boolean hasNext()Description copied from class:AbstractKafkaMessageListenerCheck ConsumerIterator whether It has next value- Specified by:
hasNextin classAbstractKafkaMessageListener
-
hasNext
public boolean hasNext(kafka.consumer.ConsumerIterator<byte[], byte[]> consumerIterator) -
hasMultipleTopicsToConsume
public boolean hasMultipleTopicsToConsume()Description copied from class:AbstractKafkaMessageListenerUsed to check whether there are multiple topics to consume from- Overrides:
hasMultipleTopicsToConsumein classAbstractKafkaMessageListener
-
consumeMultipleTopics
Description copied from class:AbstractKafkaMessageListenerConsume from multiple topics- Overrides:
consumeMultipleTopicsin classAbstractKafkaMessageListener
-