Execute event stream processing function on specific number of event windows
This function requires Streaming Data Framework for MATLAB® Production Server™.
execute( runs the
streaming processing function specified in the
Name property of
esp synchronously on
execute function starts processing event windows at the current
read position of the stream. Each event window is adjacent to the previous window, with no
gaps between windows. To change the starting position of the entire sequence, call
The first call to
execute reads events from the position in the
data stream where the read position was when
esp was constructed. On
subsequent calls to
execute, the read position is set to
Current. To change this behavior, call
Execute Event Stream Processing Function
Assume that you have a Kafka® server running at the network address
that has a topic
Create an object connected to the
ks = kafkaStream("kafka.host.com", 9092, "RecamanSequence");
Assume that you have a streaming analytic function
a function to initialize persistent state called
EventStreamProcessor object that runs the
recamanSum function and initializes persistent state with the
esp = eventStreamProcessor(ks,@recamanSum, @initRecamanSum);
esp = EventStreamProcessor with properties: StreamFunction: @recamanSum InputStream: [1×1 matlab.io.stream.event.KafkaStream] OutputStream: [1×1 matlab.io.stream.event.InMemoryStream] InitialState: @initRecamanSum GroupVariable: [0×0 string] ReadPosition: Beginning ArchiveName: "recamanSum" ResetStateOnSeek: 1
Iterate over the streaming analytic function ten times.
Move the read position indicator to the beginning of the default output data stream.
Examine the results.
result = readtimetable(esp.OutputStream)
esp — Object to process event streams
Object to process event streams, specified as an
n — Number of event windows
Number of event windows, specified as a positive integer.
Introduced in R2022b