Main Content


Start processing event streams using local test server

Since R2022b

    This function requires Streaming Data Framework for MATLAB® Production Server™ and MATLAB Compiler SDK™.



    start(esp) starts processing event streams using a local test server (development version of MATLAB Production Server) running at the default hostname localhost and port number 9910. Asynchronous event processing started with the start function continues until either the processor reaches the end of the stream or you explicitly call stop.


    Before starting event processing with start, you must start the local test server with startServer.

    start(esp,port,host) specifies the port number and the hostname of the machine on which the local test server is running.


    collapse all

    Assume that you have a Kafka® server running at the network address that has a topic RecamanSequence.

    Also assume that you have a stateful streaming analytic function recamanSum and initialization function initRecamanSum.

    Create a KafkaStream object connected to the RecamanSequence topic.

    ks = kafkaStream("",9092,"RecamanSequence");

    Create an EventStreamProcessor object that runs the recamanSum function and is initialized by the initRecamanSum function.

    esp = eventStreamProcessor(ks,@recamanSum,@initRecamanSum);

    Start the local test server, which also opens the Production Server Compiler (MATLAB Compiler SDK) app.


    Start the test server from the app by clicking Test Client and then Start. For an example on how to use the app, see Test Client Data Integration Against MATLAB (MATLAB Compiler SDK).

    Navigate back to the MATLAB command prompt to start processing events.


    In the Production Server Compiler app, the test server receives data.

    After you finish testing the processing of events, use the stop function to stop event processing and the stopServer function to shut down the server.

    Input Arguments

    collapse all

    Object to process event streams, specified as an EventStreamProcessor object.

    Port number on which the test server is running, specified as an integer in the range [0, 65,535].

    Example: 9920

    Hostname of machine on which the local test server is running, specified as a string or character vector.

    Example: '' or 'localhost'

    Data Types: string | char

    Version History

    Introduced in R2022b