Main Content


Set properties specific to Kafka configuration

Since R2022b

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



    setProviderProperties(ks,propname1,propval1,...,propnameN,propvalN) sets Kafka® stream provider properties.


    It is recommended that you set Kafka provider properties when creating a Kafka stream object using kafkaStream. If you need to set properties after object creation using setProviderProperties, set them before the object interacts with the stream, such as when reading or writing data to a Kafka topic. After the stream object interacts with an event stream, setting Kafka properties might have no effect.


    collapse all

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

    Create an event stream object connected to a Kafka topic.

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

    Set security properties that are specific to Kafka.

    setProviderProperties(ks, ...
        "security.protocol","SASL_SSL", ...

    Alternatively, you can set these properties when you create the object.

    ks = kafkaStream("",9092,"CoolingFan", ...
         "security.protocol","SASL_SSL", ...

    Input Arguments

    collapse all

    Object connected to a Kafka stream topic, specified as a KafkaStream object.

    Name of a Kafka provider property, specified as a string scalar or character vector.

    Example: "security.protocol"

    Value of a Kafka provider property, specified as a MATLAB expression. The expression must be a string or convertible to a string.

    Example: "SASL_SSL"

    More About

    collapse all

    Stream Provider Properties

    Stream providers such as Kafka have vendor-specific configuration properties that influence how the stream provider operates on the stream. Some properties apply to a single type of operation, such as topic creation, while other properties apply to multiple operations. Properties are grouped into categories so that properties are sent only to the provider with operations that support them. Because the same property can belong to multiple categories, each property is uniquely identified by the combination of its name and category.

    Version History

    Introduced in R2022b