Interface Topics.ValueStream<V>

Type Parameters:
V - the value class
All Superinterfaces:
Callback, Stream, Topics.SubscriberStream
All Known Implementing Classes:
Topics.ValueStream.Default
Enclosing interface:
Topics

public static interface Topics.ValueStream<V> extends Topics.SubscriberStream
Stream interface that can be registered to receive subscription and value events whenever an update is received from the server.

A stream implementation can be registered using addStream. The stream will receive events for the topics that are selected by the topic selector and have a compatible type.

A stream implementation can also be registered as a fallback stream using addFallbackStream. Fallback streams will receive events for all topics that are not selected by other streams the session has registered using addStream.

If the stream is removed, onClose will be called.

If the session is closed, onError will be called with ErrorReason.SESSION_CLOSED.

See Topics class documentation for further details of the use of value streams.

Since:
5.7
  • Method Details

    • onValue

      void onValue(String topicPath, TopicSpecification specification, V oldValue, V newValue)
      Notifies an update to a topic value from the server.

      This is also called to provide the current value for any matching topic that the session is already subscribed to when the stream is added.

      Parameters:
      topicPath - the topic path
      specification - the topic specification
      oldValue - the previous value. Will be null for the initial call to onValue for a topic. It can also be null if the topic's data type supports null values.
      newValue - the new value derived from the last update received from the server. It can be null if the topic's data type supports null values.