Reset read window boundaries
This function requires Streaming Data Framework for MATLAB® Production Server™.
Read Incomplete Window of Data
Assume that you have a Kafka server running at the network address
that has a topic
Also assume that the
CoolingFan topic has 5120 messages.
KafkaStream object to connect to the Kafka host. Configure the object to read 500 messages, or events, at a
inKS = kafkaStream("kafka.host.com",9092,"CoolingFan",Rows=500);
Configure a second
KafkaStream object to connect to the
CoolingFanOut topic. The Kafka host writes messages to this topic.
outKS = kafkaStream("kafka.host.com",9092,"CoolingFanOut",Rows=500);
Read 10 windows of message data from
CoolingFan and write the
CoolingFanOut. This operation processes the first 5000
for idx = 1:10 tt = readtimetable(inKS); writetimetable(outKS,tt) end
Read one more window of messages from
CoolingFan. This topic has
only 120 messages left to be read. Because
readtimetable does not
receive a full window of 500 messages, it times out and does not read the remaining
tt = readtimetable(inKS)
tt = 0×0 empty timetable
To enable reading the 120 remaining messages, flush the stream.
Read the remaining messages into a timetable and write them to
CoolingFanOut. Though the number of messages is smaller than the
readtimetable is able to read the remaining
tt = readtimetable(inKS); writetimetable(outKS,tt)
ks — Object connected to Kafka stream topic
Object connected to a Kafka stream topic, specified as a
Introduced in R2022b