UNPKG

diffusion

Version:

Diffusion JavaScript client

174 lines (164 loc) 5.97 kB
// private function function TopicType(id, stateful, functional) { this.id = id; this.stateful = stateful; this.functional = functional; } /** * Enum containing possible Topic Types. * * @example * // Get a topic type for adding topics * var topicType = diffusion.topics.TopicType.JSON; * * session.topics.add("foo", topicType); * * @readonly * @enum * @memberOf diffusion.topics * @alias TopicType */ module.exports = { /** * Slave Topic. * <P> * A topic that references another topic (the master topic) which has data * (i.e. an alias). It effectively allows a topic's data to be shared across * more than one topic node. * <P> * A client cannot tell that it is subscribed to a slave topic. A client * requesting details of a slave topic will receive the details of the * master topic. A client subscribing to the slave topic will receive all * updates to the master topic. The slave topic itself may not be updated. * <P> * Any number of slave topics may reference the same master topic. * <P> * If a topic is removed that referenced by slave topics, all such slave * topics are also automatically removed. * <P> * Slave topics are unable to be created by the Javascript client, but may safely be subscribed to. */ SLAVE : new TopicType(7, true, false), /** * Routing Topic. * <P> * A functional topic that can point to different * target topics for different clients. * <P> * From the point of view of a client subscribing to such a topic this would * be seen as a normal stateful topic but it has no * state of its own and cannot be published to. * <P> * Such a topic may specify a user written Java class which will be invoked * to define the mapping of the topic to another data topic when a client * subscribes. Alternatively the mapping can be delegated to a control * client using the SubscriptionControl feature. */ ROUTING : new TopicType(12, false, true), /** * Binary Topic. * <P> * This is a stateful topic that handles data in Binary format. * @since 5.7 */ BINARY : new TopicType(14, true, false), /** * JSON (JavaScript Object Notation) Topic. * <P> * This is a stateful topic that handles data in JSON representation. * @since 5.7 */ JSON : new TopicType(15, true, false), /** * Topic that stores and publishes String values. Based on the {@link diffusion.datatypes#string string data type}. * <P> * Supports null String values. * <P> * Supports delta-streams. * * @since 6.0 */ STRING : new TopicType(17, true, false), /** * Topic that stores and publishes 64-bit integer values. * Based on the {@link diffusion.datatypes#int64 int64 data type}. Values are of the type * {@link diffusion.datatypes.Int64}. * * <P> * Supports null int64 values. * <P> * Does not support delta-streams - only complete values are transmitted. * * @since 6.0 */ INT64 : new TopicType(18, true, false), /** * Topic that stores and publishes IEEE 754 double-precision floating point numbers (i.e native JavaScript Numbers). * Based on the {@link diffusion.datatypes#double double data type}. * <P> * Supports null Double values. * <P> * The topic does not support delta-streams - only complete values are transmitted. * * @since 6.0 */ DOUBLE : new TopicType(19, true, false), /** * Time Series Topic. * * <p> * A <em>time series</em> is a sequence of events. Each event contains a * value and has server-assigned metadata comprised of a sequence number, * timestamp, and author. * <p> * A time series topic allows sessions to access a time series that is * maintained by the server. A time series topic has an associated * {@link DataType event data type}, such as <code>Binary</code>, <code>String</code>, * or <code>JSON</code>, that determines the type of value associated with each * event. * * <h4>Retained range</h4> * * <p> * The {@link TopicSpecification#TIME_SERIES_SUBSCRIPTION_RANGE * TIME_SERIES_SUBSCRIPTION_RANGE} property configures the range of historic * events retained by a time series topic. If the property is not specified, * a time series topic will retain the ten most recent events. * * <h4>Subscription range</h4> * * <p> * The {@link TopicSpecification#TIME_SERIES_SUBSCRIPTION_RANGE * TIME_SERIES_SUBSCRIPTION_RANGE} property configures a time series topic * to send a range of historic events from the end of the time series to new * subscribers. This is a convenient way to synchronize new subscribers * without requiring the use of a {@link Session.timeseries#rangeQuery() range * query}. * <p> * By default, new subscribers will be sent the latest event if delta * streams are enabled and no events if delta streams are disabled. See the * description of <em>Subscription range</em> in the {@link Session.timeseries} time * series feature} documentation. * * * <h4>Mandatory properties</h4> * <p> * The {@link TopicSpecification#TIME_SERIES_EVENT_VALUE_TYPE * TIME_SERIES_EVENT_VALUE_TYPE} property must be provided when creating a * time series topic. * * * @since 6.0 * @see diffusion.datatypes.TimeSeriesDataType */ TIME_SERIES : new TopicType(16, true, false), /** * Topic that stores and publishes data in the form of records and fields. * Based on the {@link diffusion.data.RecordV2DataType RecordV2} data type. * <p> * Supports delta-streams. * * @since 6.0 */ RECORD_V2 : new TopicType(20, true, false) };