Class KAFKAMessageListener
- java.lang.Object
-
- org.wso2.carbon.inbound.endpoint.protocol.kafka.AbstractKafkaMessageListener
-
- org.wso2.carbon.inbound.endpoint.protocol.kafka.KAFKAMessageListener
-
public class KAFKAMessageListener extends AbstractKafkaMessageListener
-
-
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
Constructors Constructor Description KAFKAMessageListener(int threadCount, List<String> topics, Properties kafkaProperties, InjectHandler injectHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
consumeMultipleTopics(String name)
Consume from multiple topicsboolean
createKafkaConsumerConnector()
Create the connection with the zookeeper to consume the messagesboolean
hasMultipleTopicsToConsume()
Used to check whether there are multiple topics to consume fromboolean
hasNext()
Check ConsumerIterator whether It has next valueboolean
hasNext(kafka.consumer.ConsumerIterator<byte[],byte[]> consumerIterator)
void
injectMessageToESB(String name)
Poll the messages from the zookeeper and injected to the sequencevoid
injectMessageToESB(String sequenceName, kafka.consumer.ConsumerIterator<byte[],byte[]> consumerIterator)
void
start()
Starts topics consuming the messages,the message can be consumed by topic or topic filter which are white list and black list.protected void
startConsumers(List<kafka.consumer.KafkaStream<byte[],byte[]>> streams)
Use one stream from kafka stream iterator-
Methods inherited from class org.wso2.carbon.inbound.endpoint.protocol.kafka.AbstractKafkaMessageListener
destroy
-
-
-
-
Constructor Detail
-
KAFKAMessageListener
public KAFKAMessageListener(int threadCount, List<String> topics, Properties kafkaProperties, InjectHandler injectHandler) throws Exception
- Throws:
Exception
-
-
Method Detail
-
createKafkaConsumerConnector
public boolean createKafkaConsumerConnector() throws Exception
Create the connection with the zookeeper to consume the messages- Specified by:
createKafkaConsumerConnector
in classAbstractKafkaMessageListener
- Throws:
Exception
-
start
public void start() throws Exception
Starts topics consuming the messages,the message can be consumed by topic or topic filter which are white list and black list.- Specified by:
start
in classAbstractKafkaMessageListener
- Throws:
Exception
-
startConsumers
protected void startConsumers(List<kafka.consumer.KafkaStream<byte[],byte[]>> streams)
Use one stream from kafka stream iterator- Parameters:
streams
-
-
injectMessageToESB
public void injectMessageToESB(String name)
Description copied from class:AbstractKafkaMessageListener
Poll the messages from the zookeeper and injected to the sequence- Specified by:
injectMessageToESB
in classAbstractKafkaMessageListener
-
injectMessageToESB
public void injectMessageToESB(String sequenceName, kafka.consumer.ConsumerIterator<byte[],byte[]> consumerIterator)
-
hasNext
public boolean hasNext()
Description copied from class:AbstractKafkaMessageListener
Check ConsumerIterator whether It has next value- Specified by:
hasNext
in classAbstractKafkaMessageListener
-
hasNext
public boolean hasNext(kafka.consumer.ConsumerIterator<byte[],byte[]> consumerIterator)
-
hasMultipleTopicsToConsume
public boolean hasMultipleTopicsToConsume()
Description copied from class:AbstractKafkaMessageListener
Used to check whether there are multiple topics to consume from- Overrides:
hasMultipleTopicsToConsume
in classAbstractKafkaMessageListener
-
consumeMultipleTopics
public void consumeMultipleTopics(String name)
Description copied from class:AbstractKafkaMessageListener
Consume from multiple topics- Overrides:
consumeMultipleTopics
in classAbstractKafkaMessageListener
-
-