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 Details

    • subscribeToUpdates

      void subscribeToUpdates(String tagId, Consumer<TimestampedValue> callback)
      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

      void unsubscribeFromUpdates(String tagId)
      Unsubscribe from updates for a specific tag.
      Parameters:
      tagId - the tag identifier
    • publishBatch

      void publishBatch(Map<String, TimestampedValue> values)
      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

      default void publish(String tagId, TimestampedValue value)
      Publish a single value for a tag.
      Parameters:
      tagId - the tag identifier
      value - 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

      List<TimestampedValue> getHistory(String tagId, Duration lookback)
      Get historical values for a tag.
      Parameters:
      tagId - the tag identifier
      lookback - how far back to retrieve data
      Returns:
      list of timestamped values, ordered oldest to newest
    • getHistoryBatch

      Map<String, List<TimestampedValue>> getHistoryBatch(List<String> tagIds, Duration lookback)
      Get historical values for multiple tags aligned by timestamp.
      Parameters:
      tagIds - list of tag identifiers
      lookback - how far back to retrieve data
      Returns:
      map of tag IDs to their historical values
    • getCurrentValue

      TimestampedValue getCurrentValue(String tagId)
      Get the current value for a tag.
      Parameters:
      tagId - the tag identifier
      Returns:
      the most recent value, or null if not available
    • isMonitored

      boolean isMonitored(String tagId)
      Check if a tag is being monitored.
      Parameters:
      tagId - the tag identifier
      Returns:
      true if the tag has subscribers or is being tracked
    • getMonitoredTags

      List<String> getMonitoredTags()
      Get all currently monitored tag IDs.
      Returns:
      list of tag identifiers
    • 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.