Main Content

startServer

Start local test server

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

    Description

    example

    startServer(esp) launches a local test server (development version of MATLAB Production Server) that simulates the production environment so that you can test event processing.

    startServer generates a MATLAB project file for the Production Server Compiler (MATLAB Compiler SDK) app. In addition to simulating production with this file on a local test server, you can use the generated project file to create a CTF archive.

    startServer(esp,ExtraFiles=files) adds additional files to the CTF archive when starting the local test server.

    Examples

    collapse all

    Assume that you have a Kafka® server running at the network address kafka.host.com:9092 that has a topic RecamanSequence.

    Also assume that you have a streaming analytic function recamanSum and a function initRecamanSum to initialize persistent state.

    Create a KafkaStream object connected to the RecamanSequence topic.

    ks = kafkaStream("kafka.host.com",9092,"RecamanSequence");

    Create an EventStreamProcessor object that runs the recamanSum function, which 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.

    Note

    To use the test server, you require MATLAB Compiler SDK.

    startServer(esp);

    Once the app opens, you must start the test server manually.

    To start the test server from the app, click 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.

    start(esp);

    Using the MATLAB editor, you can set breakpoints in the recamanSum function to examine the incoming streaming data when you start the server.

    Input Arguments

    collapse all

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

    Additional files to include in the generated archive, specified as a character vector or string scalar for a single file, or as a string array for multiple files.

    Extra files are necessary only if you plan to use the generated project file to deploy a CTF archive to MATLAB Production Server. For other ways to create deployable archives, see the package and streamingDataCompiler functions.

    Example: archive = startServer(esp,"ExtraFiles"=["data.mat", "/schema/registry/schema.json"]) includes the files data.mat and schema.json in the generated deployable archive.

    Data Types: char | string

    Version History

    Introduced in R2022b