Learn R Programming

rkafka (version 1.1)

rkafka.readPoll: KAFKA consumer reading messages(batch)

Description

This function reads messages received by a KAFKA consumer. It returns a batch of messages

Usage

rkafka.readPoll(ConsumerObj)

Arguments

ConsumerObj

Consumer through which messages are to be read Required:Mandatory Type:Consumer

Value

Array of Strings

Details

This function returns messages as a batch from the topic to which the consumer is associated. If no new message is found with 'x' time(set by ConsumerTimeoutMs property), then it returns ""

References

To know when to use simple consumer and when to use High-level Consumer, refer the url below: https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example

To know how to use a high level consumer refer this: https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example

Examples

Run this code
# NOT RUN {
consumer1=rkafka.createConsumer("127.0.0.1:2181","test123")
print(rkafka.readPoll(consumer1)
# }

Run the code above in your browser using DataLab