AssetProducer#
- class openfactory.kafka.AssetProducer(asset_uuid, ksqlClient, bootstrap_servers=None)[source]#
Bases:
ProducerKafka producer for sending OpenFactory asset data.
This class wraps a Kafka producer and binds it to a specific asset and topic used by OpenFactory.
- ksql#
Client used to interact with ksqlDB.
- Type:
- __init__(asset_uuid, ksqlClient, bootstrap_servers=None)[source]#
Initializes the AssetProducer.
- Parameters:
asset_uuid (str) – UUID of the asset this producer is associated with.
ksqlClient (KSQLDBClient) – Client to retrieve Kafka topic info, typically a wrapper over ksqlDB.
bootstrap_servers (str) – Kafka bootstrap server address, defaults to value from config.
- send_asset_attribute(assetAttribute)[source]#
Sends a Kafka message representing an asset attribute.
Constructs a JSON message from the given asset attribute and sends it to the Kafka ASSETS_STREAM topic.
- Return type:
- Parameters:
assetAttribute (AssetAttribute) – The asset attribute object containing value, type, tag, and timestamp.