Main Content

package

Package stream processing function into deployable archive configured by EventStreamProcessor

Since R2022b

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

    Description

    filePath = package(esp) uses the eventStreamProcessor object esp to create a MATLAB Compiler SDK project file and opens the Production Server Compiler (MATLAB Compiler SDK) app. Use this app to package the streaming function into a deployable archive for MATLAB Production Server.

    package returns the full path to the project file.

    example

    filePath = package(esp,Name=Value) sets additional options for packaging the function.

    For example, if you specify OutputType="Archive", the package function returns a deployable archive (CTF file) instead of a project file.

    Examples

    collapse all

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

    Also, assume that you have a streaming analytic function classifyTriangle.

    Create a KafkaStream object connected to the Triangles topic.

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

    Create an EventStreamProcessor object to run the classifyTriangle streaming analytic function.

    esp = eventStreamProcessor(ks,@classifyTriangle);

    You can use EventStreamProcesor functions such as execute, startServer, start, stopServer, and stop to iterate over and test the streaming analytic functions using a local test server. Then, you can package the streaming analytic function classifyTriangle into a deployable archive for deployment to MATLAB Production Server.

    file = package(esp)
    file = 
    
        "J:\classifyTriangle.prj"

    The package function generates a MATLAB project file based on the eventStreamProcessor object, returns the path to this file, and opens this project file with the Production Server Compiler (MATLAB Compiler SDK) app. The project file contains values for:

    • The streaming analytic function, classifyTriangle.m

    • The entry point function, streamfcn.m

    • The deployable archive, classifyTriangle.ctf

    To modify the list of deployed functions or the name of the generated archive, see Customize Application and Its Appearance (MATLAB Compiler SDK).

    In the Production Server Compiler, click Package to generate the deployable archive. You can deploy the generated archive to MATLAB Production Server. For more information on deploying to MATLAB Production Server, see Deploy Archive to MATLAB Production Server.

    Input Arguments

    collapse all

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

    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: filePath = package(esp,OutputFolder='J:\')

    Type of file created by the package function, specified as one of these values.

    • Project — Creates a productionServerCompiler project file and launches the Production Server Compiler app. You can create a CTF file using the Production Server Compiler app.

    • Archive — Creates a CTF file.

    Data Types: char | string

    Persistent storage connection name, specified as a string or character vector. You must specify a StateStore when using InitialState or when using a stateful stream function. The connection name must be known to the MATLAB Production Server instance to which the archive will be deployed. For more information on using a data cache for persistent storage, see Data Caching Basics.

    Data Types: char | string

    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.

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

    Data Types: char | string

    Location of the generated file, specified as a string or character vector.

    Example: OutputFolder='J:\' saves the generated file in J:\.

    Data Types: string | char

    Name of the generated deployable archive, specified as a string or character vector.

    Data Types: char | string

    Flag to automatically open the project in MATLAB, specified as logical true or false. This property is incompatible with OutputType="Archive".

    Data Types: logical

    Version History

    Introduced in R2022b