Subscription class
Class representing a Subscription to be submitted to a Lightstreamer Server.
It contains subscription details and the listeners needed to process the real-time data.
After the creation, a Subscription object is in the "inactive" state. When a Subscription
object is subscribed to on a LightstreamerClient object, through the
LightstreamerClient.subscribe method, its state becomes "active".
This means that the client activates a subscription to the required items through
Lightstreamer Server and the Subscription object begins to receive real-time events.
A Subscription can be configured to use either an Item Group or an Item List to specify the
items to be subscribed to and using either a Field Schema or Field List to specify the fields.
"Item Group" and "Item List" are defined as follows:
- "Item Group": an Item Group is a String identifier representing a list of items.
Such Item Group has to be expanded into a list of items by the getItems method of the
MetadataProvider of the associated Adapter Set. When using an Item Group, items in the
subscription are identified by their 1-based index within the group.
It is possible to configure the Subscription to use an "Item Group" using the [setItemGroup] method. - "Item List": an Item List is an array of Strings each one representing an item.
For the Item List to be correctly interpreted a LiteralBasedProvider or a MetadataProvider
with a compatible implementation of getItems has to be configured in the associated
Adapter Set.
Note that no item in the list can be empty, can contain spaces or can be a number.
When using an Item List, items in the subscription are identified by their name or by their 1-based index within the list.
It is possible to configure the Subscription to use an "Item List" using the [setItems] method or by specifying it in the constructor.
- "Field Schema": a Field Schema is a String identifier representing a list of fields.
Such Field Schema has to be expanded into a list of fields by the getFields method of
the MetadataProvider of the associated Adapter Set. When using a Field Schema, fields
in the subscription are identified by their 1-based index within the schema.
It is possible to configure the Subscription to use a "Field Schema" using the [setFieldSchema] method. - "Field List": a Field List is an array of Strings each one representing a field.
For the Field List to be correctly interpreted a LiteralBasedProvider or a MetadataProvider
with a compatible implementation of getFields has to be configured in the associated
Adapter Set.
Note that no field in the list can be empty or can contain spaces.
When using a Field List, fields in the subscription are identified by their name or by their 1-based index within the list.
It is possible to configure the Subscription to use a "Field List" using the [setFields] method or by specifying it in the constructor.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
SubscriptionListener listener) → void - Adds a listener that will receive events from the Subscription instance.
-
getCommandPosition(
) → int? - Returns the position of the "command" field in a COMMAND Subscription.
-
getCommandSecondLevelDataAdapter(
) → String? - Inquiry method that can be used to read the second-level Data Adapter name configured through setCommandSecondLevelDataAdapter.
-
getCommandSecondLevelFields(
) → List< String> ? - Inquiry method that can be used to read the "Field List" specified for second-level Subscriptions.
-
getCommandSecondLevelFieldSchema(
) → String? - Inquiry method that can be used to read the "Field Schema" specified for second-level Subscriptions.
-
getCommandValue(
String itemNameOrPosition, String keyValue, String fieldNameOrPosition) → Future< String?> - Returns the latest value received for the specified item/key/field combination.
-
getDataAdapter(
) → String? - Inquiry method that can be used to read the name of the Data Adapter specified for this Subscription through setDataAdapter.
-
getFields(
) → List< String> ? - Inquiry method that can be used to read the "Field List" specified for this Subscription.
-
getFieldSchema(
) → String? - Inquiry method that can be used to read the field schema specified for this Subscription.
-
getItemGroup(
) → String? - Inquiry method that can be used to read the item group specified for this Subscription.
-
getItems(
) → List< String> ? - Inquiry method that can be used to read the "Item List" specified for this Subscription.
-
getKeyPosition(
) → int? - Returns the position of the "key" field in a COMMAND Subscription.
-
getListeners(
) → List< SubscriptionListener> - Returns a list containing the SubscriptionListener instances that were added to this client.
-
getMode(
) → String - Inquiry method that can be used to read the mode specified for this Subscription.
-
getRequestedBufferSize(
) → String? - Inquiry method that can be used to read the buffer size, configured though setRequestedBufferSize, to be requested to the Server for this Subscription.
-
getRequestedMaxFrequency(
) → String? - Inquiry method that can be used to read the max frequency, configured through setRequestedMaxFrequency, to be requested to the Server for this Subscription.
-
getRequestedSnapshot(
) → String? - Inquiry method that can be used to read the snapshot preferences, configured through setRequestedSnapshot, to be requested to the Server for this Subscription.
-
getSelector(
) → String? -
Inquiry method that can be used to read the selector name
specified for this Subscription through setSelector. -
getValue(
String itemNameOrPosition, String fieldNameOrPosition) → Future< String?> - Returns the latest value received for the specified item/field pair.
-
isActive(
) → bool - Inquiry method that checks if the Subscription is currently "active" or not.
-
isSubscribed(
) → bool - Inquiry method that checks if the Subscription is currently subscribed to through the server or not.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeListener(
SubscriptionListener listener) → void - Removes a listener from the Subscription instance so that it will not receive events anymore.
-
setCommandSecondLevelDataAdapter(
String? dataAdapter) → void - Setter method that sets the name of the second-level Data Adapter (within the Adapter Set used by the current session) that supplies all the second-level items.
-
setCommandSecondLevelFields(
List< String> ? fields) → void - Setter method that sets the "Field List" to be subscribed to through Lightstreamer Server for the second-level items.
-
setCommandSecondLevelFieldSchema(
String? schemaName) → void - Setter method that sets the "Field Schema" to be subscribed to through Lightstreamer Server for the second-level items.
-
setDataAdapter(
String? dataAdapter) → void - Setter method that sets the name of the Data Adapter (within the Adapter Set used by the current session) that supplies all the items for this Subscription.
-
setFields(
List< String> ? fields) → void - Setter method that sets the "Field List" to be subscribed to through Lightstreamer Server.
-
setFieldSchema(
String? schemaName) → void - Setter method that sets the "Field Schema" to be subscribed to through Lightstreamer Server.
-
setItemGroup(
String? groupName) → void - Setter method that sets the "Item Group" to be subscribed to through Lightstreamer Server.
-
setItems(
List< String> ? items) → void - Setter method that sets the "Item List" to be subscribed to through Lightstreamer Server.
-
setRequestedBufferSize(
String? size) → void - Setter method that sets the length to be requested to Lightstreamer Server for the internal queuing buffers for the items in the Subscription.
-
setRequestedMaxFrequency(
String? freq) → Future< void> - Setter method that sets the maximum update frequency to be requested to Lightstreamer Server for all the items in the Subscription.
-
setRequestedSnapshot(
String? isRequired) → void - Setter method that enables/disables snapshot delivery request for the items in the Subscription.
-
setSelector(
String? selector) → void - Setter method that sets the selector name for all the items in the Subscription. The selector is a filter on the updates received.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited