Interface StreamingDataInterface
- All Known Implementing Classes:
ProcessDataPublisher
public interface StreamingDataInterface
Interface for high-frequency real-time data streaming.
Designed for integration with AI-powered production optimization platforms that require continuous data feeds at high rates (millions of data points per hour).
Key features:
- Subscribe to real-time updates via callbacks
- Batch publishing for efficiency
- State vector extraction for ML model input
- Historical data access for training
- Version:
- 1.0
- Author:
- ESOL
-
Method Summary
Modifier and TypeMethodDescriptionvoidClear all historical data.getCurrentValue(String tagId) Get the current value for a tag.getHistory(String tagId, Duration lookback) Get historical values for a tag.getHistoryBatch(List<String> tagIds, Duration lookback) Get historical values for multiple tags aligned by timestamp.Get all currently monitored tag IDs.double[]Get current state vector for ML model input.String[]Get labels for state vector elements.booleanisMonitored(String tagId) Check if a tag is being monitored.default voidpublish(String tagId, TimestampedValue value) Publish a single value for a tag.voidpublishBatch(Map<String, TimestampedValue> values) Publish a batch of values for multiple tags efficiently.voidsetHistoryBufferSize(int maxSamples) Set the buffer size for historical data.voidsubscribeToUpdates(String tagId, Consumer<TimestampedValue> callback) Subscribe to real-time updates for a specific tag.voidunsubscribeFromUpdates(String tagId) Unsubscribe from updates for a specific tag.
-
Method Details
-
subscribeToUpdates
Subscribe to real-time updates for a specific tag.- Parameters:
tagId- the tag identifier (e.g., "PT-101", "FT-200")callback- function to call when new values arrive
-
unsubscribeFromUpdates
Unsubscribe from updates for a specific tag.- Parameters:
tagId- the tag identifier
-
publishBatch
Publish a batch of values for multiple tags efficiently.This method is optimized for high-throughput scenarios where many values need to be published simultaneously.
- Parameters:
values- map of tag IDs to their timestamped values
-
publish
Publish a single value for a tag.- Parameters:
tagId- the tag identifiervalue- the timestamped value
-
getStateVector
double[] getStateVector()Get current state vector for ML model input.Returns a numeric array representing the current state of all monitored variables. The order and meaning of elements is defined by
getStateVectorLabels().- Returns:
- array of current state values
-
getStateVectorLabels
String[] getStateVectorLabels()Get labels for state vector elements.- Returns:
- array of tag IDs corresponding to state vector positions
-
getHistory
Get historical values for a tag.- Parameters:
tagId- the tag identifierlookback- how far back to retrieve data- Returns:
- list of timestamped values, ordered oldest to newest
-
getHistoryBatch
-
getCurrentValue
Get the current value for a tag.- Parameters:
tagId- the tag identifier- Returns:
- the most recent value, or null if not available
-
isMonitored
Check if a tag is being monitored.- Parameters:
tagId- the tag identifier- Returns:
- true if the tag has subscribers or is being tracked
-
getMonitoredTags
-
setHistoryBufferSize
void setHistoryBufferSize(int maxSamples) Set the buffer size for historical data.- Parameters:
maxSamples- maximum number of samples to retain per tag
-
clearHistory
void clearHistory()Clear all historical data.
-