flush
This function requires Streaming Data Framework for MATLAB® Production Server™.
Syntax
Description
Examples
Read Incomplete Window of Data
Assume that you have a Kafka server running at the network address kafka.host.com:9092
that has a topic CoolingFan
.
Also assume that the CoolingFan
topic has 5120 messages.
Create a KafkaStream
object to connect to the Kafka host. Configure the object to read 500 messages, or events, at a
time.
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
data to CoolingFanOut
. This operation processes the first 5000
messages from CoolingFan
.
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
messages.
tt = readtimetable(inKS)
tt = 0×0 empty timetable
To enable reading the 120 remaining messages, flush the stream.
flush(inKS)
Read the remaining messages into a timetable and write them to
CoolingFanOut
. Though the number of messages is smaller than the
window size, readtimetable
is able to read the remaining
messages.
tt = readtimetable(inKS); writetimetable(outKS,tt)
Input Arguments
ks
— Object connected to Kafka stream topic
KafkaStream
object
Object connected to a Kafka stream topic, specified as a KafkaStream
object.
Version History
Introduced in R2022b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)