Class AbstractKafkaMessageListener
- java.lang.Object
-
- org.wso2.carbon.inbound.endpoint.protocol.kafka.AbstractKafkaMessageListener
-
- Direct Known Subclasses:
KAFKAMessageListener,SimpleKafkaMessageListener
public abstract class AbstractKafkaMessageListener extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractKafkaMessageListener.CONSUMER_TYPEthe consumer types are high level and simple,high level is used for kafka high level configuration and simple is used for kafka low level configuration
-
Field Summary
Fields Modifier and Type Field Description protected kafka.javaapi.consumer.ConsumerConnectorconsumerConnectorprotected List<kafka.consumer.ConsumerIterator<byte[],byte[]>>consumerIteprotected InjectHandlerinjectHandlerprotected PropertieskafkaPropertiesprotected static org.apache.commons.logging.Loglogprotected intthreadCountprotected List<String>topics
-
Constructor Summary
Constructors Constructor Description AbstractKafkaMessageListener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidconsumeMultipleTopics(String sequenceName)Consume from multiple topicsabstract booleancreateKafkaConsumerConnector()Create the connection with the zookeepervoiddestroy()Destroy consuming the messagesbooleanhasMultipleTopicsToConsume()Used to check whether there are multiple topics to consume fromabstract booleanhasNext()Check ConsumerIterator whether It has next valueabstract voidinjectMessageToESB(String name)Poll the messages from the zookeeper and injected to the sequenceabstract voidstart()Start to consume the messages from topics
-
-
-
Field Detail
-
threadCount
protected int threadCount
-
consumerConnector
protected kafka.javaapi.consumer.ConsumerConnector consumerConnector
-
injectHandler
protected InjectHandler injectHandler
-
kafkaProperties
protected Properties kafkaProperties
-
consumerIte
protected List<kafka.consumer.ConsumerIterator<byte[],byte[]>> consumerIte
-
log
protected static final org.apache.commons.logging.Log log
-
-
Method Detail
-
createKafkaConsumerConnector
public abstract boolean createKafkaConsumerConnector() throws ExceptionCreate the connection with the zookeeper- Throws:
Exception
-
start
public abstract void start() throws ExceptionStart to consume the messages from topics- Throws:
Exception
-
destroy
public void destroy()
Destroy consuming the messages
-
injectMessageToESB
public abstract void injectMessageToESB(String name)
Poll the messages from the zookeeper and injected to the sequence
-
hasNext
public abstract boolean hasNext()
Check ConsumerIterator whether It has next value
-
hasMultipleTopicsToConsume
public boolean hasMultipleTopicsToConsume()
Used to check whether there are multiple topics to consume from
-
consumeMultipleTopics
public void consumeMultipleTopics(String sequenceName)
Consume from multiple topics
-
-