Overview
TheStream class is a producer for continuous syncing at a specified sync rate. Use this class when you want the library to handle the syncing logic for you by providing a handler function that returns signal data for publishing.
Constructor
Configuration object containing broker connection details. Must include:
url: Broker URLsub_topic: Subscription topicpub_topic: Publishing topicgroup: Consumer groupauto_offset_reset: Offset reset policy (default: “latest”)
Time interval between syncs in seconds (supports sub-second values, e.g., 0.5 for 500ms)
Methods
publish()
Handler function that returns a Signal dataclass for publishing. The function should return a
Signal object with the data to be published.Optional tuple of parameters to pass to the handler function. If provided, the handler will be called with these parameters.
If
True, runs the sync loop only once and then stops. If False, continues syncing at the specified rate until manually stopped.Properties
config
Gets or sets the broker configuration.sync
Boolean flag that controls whether the stream should continue syncing. Set toFalse to stop the sync loop.