seek
This function requires Streaming Data Framework for MATLAB® Production Server™.
Description
Examples
Assume that you have a Kafka® server running at the network address kafka.host.com:9092
that has a topic RecamanSequence.
Create a KafkaStream object connected to the
RecamanSequence topic.
ks = kafkaStream("kafka.host.com",9092,"RecamanSequence");
Assume that you have a stateful streaming analytic function
recamanSum and a function to initialize the per-iteration state
data called initRecamanSum. Create an
EventStreamProcessor object that runs the
recamanSum function and initializes the state data for the first
iteration with the initRecamanSum function.
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: 1Iterate the streaming analytic function over ten event windows.
execute(esp,10);
Check the result of the recamanSum
function.
result = readtimetable(esp.OutputStream)
Input Arguments
Object to process event streams, specified as an EventStreamProcessor object.
Position in an event stream, specified as one of the following values.
"Beginning"— First event available in the event stream"End"— End of the event stream, which is one event past the latest event in the stream"Current"— Just past the current event in the stream
Example: seek(esp,"Beginning") moves the event stream position to
the first event in the event stream.
Data Types: string
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: seek(esp,"Beginning",ClearState=true) moves the read position
to the first event in the stream and clears the persistent data state.
Flag to clear persistent state of data after calling the seek
function, specified as a logical scalar. The default value is the value of the
EventStreamProcessor property ResetStateOnSeek.
Data Types: logical
Per-iteration state value of the stream processing function after calling the
seek function, specified as any valid MATLAB data type.
If the streaming analytic function is stateful, then
PersistState must be a MATLAB value of the same type as the value returned by the state initialization
function set in esp. If the streaming analytic function is
stateless, you cannot specify PersistState.
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)