Data source described in the Data Source API section all are finite type of data source int he sense that they all have a finite number of rows. SymetryML also support Stream Data Source that in theory can contain an infinite number of rows. Currently, both Kafka and NATS Stream Data Sources are supported.
To use a Kafka stream data source, create a JSON data structure described in DSInfo that contains the fields in the table below. Please note that for SymetryML to be able to read the data in your topic it needs to use both the KafkaAvroDeserializer as well as the Kafka Registry.
Kafka Stream configuration parameter. Default to all partitions. The list of partition to use must be defined as a list of comma separated integers. For instance 0,2,4,6,8 or 0,1,2,6,7,10,12.
kafka_stream_time_between_persist
Optional
Default to 300 seconds, that is 5 minutes. How long to wait between when the Symetry Project will persist its state. To disable this pass -1.
enable.auto.commit
Optional
Kafka Stream configuration parameter. Default to true
auto.commit.interval.ms
Optional
Kafka Stream configuration parameter. Default to 1000 ms.
auto.offset.reset
Optional
Kafka Stream configuration parameter. Default to earliest
Any other kafka parameter
Optional
Any Kafka parameters can be used as well. One needs to prefix them with sml.kafka. e.g. sml.kafka.client.dns.lookup or sml.kafka.fetch.min.bytes
NATS is a lightweight, high-performance messaging system that provides both publish-subscribe and distributed queueing capabilities. SymetryML can connect to NATS servers to consume streaming data in real-time.
To use a NATS stream data source, create a JSON data structure described in DSInfo with type set to nats and include the following fields in the info map:
Key
Required / Optional
Description
nats_hosts
Required
NATS server URL(s) to connect to. For example: nats://localhost:4222. Multiple hosts can be specified as a comma-separated list.
nats.subject
Required
NATS subject to subscribe to. The subject determines which messages the stream will receive.
data.format
Required
Format of the data in the NATS messages. Supported values: json, csv, or protobuf
protobuf.schema
Required (protobuf)
Protobuf schema definition. Required only when data.format is set to protobuf.
protobuf.msg.type.name
Required (protobuf)
Protobuf message type name to deserialize. Required only when data.format is set to protobuf.
nats_sec_user
Optional
Username for NATS authentication. Use for user/password authentication.
nats_sec_passwd
Optional
Password for NATS authentication. Use in combination with nats_sec_user.
nats_sec_token
Optional
Token for NATS authentication. Use for token-based authentication.
nats_sec_nkey_seed
Optional
NKey seed for NATS authentication. Use for NKey-based authentication.
nats_req_timeout
Optional
Request timeout in seconds. Default is 30 seconds.
nats_stream_max_memory
Optional
Maximum memory (in bytes) for the NATS stream buffer. Default is 1073741824 (1 GB).
Same as one need to encrypt normal data source, stream data source information needs to be encrypted. Please consult the Data Source Encryption for details.
This API function creates a new stream data source and attach it to a SymetryML project - the owner project. Once created the new stream data source will continuously pull data from Kafka and then push the new data tuple into SymetryML Project in a streaming fashion.
This rest endpoint return information about a stream. Number of rows processed, tuples / secs processed, etc… Information varies with the type of the stream.
This rest endpoint return a list of error for a given stream. Since stream happen asynchronously in the background, it allows to check for any problems with a given stream