Overview

The following readers exist:

▪    StateReader

▪    StateChangeReader

▪    EventReader

StateReader

Description

This entity is used to subscribe to State Topics. It builds a local cache that holds the latest state for all instances on the Topic. The application logic can then query this cache whenever it needs information from the Topic. Currently, the only operation defined on the StateReader is iteration over all instances in the cache.

Icon

In the future, more operations will be added, including lookup of an instance based on key fields, or based on a predicate over the field values of the Topic's Data Type.

Notifications

The accompanying StateReaderListener offers a single notification:

  • onUpdate() indicates that something has changed in the local cache (i.e. the global state of the Topic has changed). The notification offers no details on the exact nature of the change; it is up to the application to iterate over the cache to find out what has changed.

StateChangeReader

Description

This entity is used to subscribe to State Topics. Contrary to the plain StateReader, it does not build up a local cache of the Topic state. Rather, it offers a notifications-only interface that is more akin to the semantics of an EventReader. The StateChangeReader is designed to allow applications to treat state transitions as events. Note that the contract of the State Behavior still applies: there is no guarantee that the application will be notified of every single state transition. If state transitions for a given instance occur in rapid succession, Qeo may aggregate them and notify only once.

Notifications

The StateChangeReaderListener offers the following notifications:

  • onData(data : T) a new value has been published on the Topic. This signifies either the creation of a new instance or the update of an existing instance. The published value is included as the data argument.
  • onRemove(data : T) an instance was removed from the Topic. Only the key fields of the data argument have valid values; all other fields should be ignored.
  • onNoMoreData() there are no immediate pending notifications for the Reader. This notification is sent after a series of onData or onRemove notifications. This allows applications to aggregate the incoming notifications and perform, for example, an update of the user interface just once instead of upon every single notification.

EventReader

Description

This entity is used to subscribe to Event Topics. The only interactions possible are through its attached EventReaderListener. 

Notifications

This listener offers the following notifications:

  • onData(data : T) a new event has been published on the Topic. The event value is included as the data argument. This is the application's only chance to register the event: after this notification, the EventReader forgets about the event.
  • onNoMoreData() there are no immediate pending notifications for the Reader. This notification is sent after a series of onData notifications. This allows applications to aggregate the incoming notifications and perform, for example, an update of the user interface  just once instead of upon every single notification.