Options
All
  • Public
  • Public/Protected
  • All
Menu

Diffusion JavaScript API 6.4.10

Index

Enumerations

Classes

Interfaces

Type aliases

Events

Variables

Functions

Object literals

Type aliases

AnonymousConnectionAction

AnonymousConnectionAction: "deny" | "allow" | "abstain"

Action to be taken by the system authentication handler for connection attempts that do not provide a principal name and credentials.

Callback

Callback: function

Type declaration

    • (error: any): U
    • Parameters

      • error: any

      Returns U

Credentials

Credentials: string | Buffer | null | undefined

The credentials that a session uses to authenticate itself.

When running the Diffusion Client in a browser context, access to the Buffer api is made available through {@link diffusion.buffer}.

Int64SourceType

Int64SourceType: string | number | Buffer | Int64

Json

Json: JSON

Alias for the JSON interface to keep compatibility with old TypeScript definitions

JsonDataType

JsonDataType: JSONDataType

Alias for the JSONDataType interface to keep compatibility with old TypeScript definitions

ReconnectStrategy

ReconnectStrategy: function

Type declaration

    • (reconnect: function, abort: function): void
    • Parameters

      • reconnect: function
          • (): void
          • Returns void

      • abort: function
          • (): void
          • Returns void

      Returns void

Result

Result: Promise<R>

A Result represents a promise for the result of an async operation.

It implements the full ES6 Promise specification and is in all respects equivalent to a Promise.

Adapted from https://www.npmjs.com/package/@types/es6-promise

SendResult

SendResult: MessageSendResult

Alias for the MessageSendResult interface to keep compatibility with old TypeScript definitions

SessionOptions

SessionOptions: Options

Alias for the Options interface to keep compatibility with old TypeScript definitions

StreamCallback

StreamCallback: function

A callback function type for Streams

Type declaration

    • (...args: any[]): void
    • Parameters

      • Rest ...args: any[]

      Returns void

StringSourceType

StringSourceType: string | object

TypedArray

TypedArray: Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Float32Array | Float64Array

UpdateSourceHandler

UpdateSourceHandler: TopicUpdateHandler

Alias for the TopicUpdateHandler interface to keep compatibility with old TypeScript definitions

Events

close

close: function

Emitted when the Stream has been closed through completion or the underlying session has been closed. No further events will be emitted after this.

param

the reason why the stream was closed

Type declaration

    • (reason?: undefined | string): void
    • Parameters

      • Optional reason: undefined | string

      Returns void

error

error: function

Emitted when an error occurs in the Stream or in any of its listeners. No further events will be emitted after this.

Type declaration

    • (err: Error): void
    • the error that occurred

      Parameters

      • err: Error

      Returns void

Variables

Const buffer

buffer: object = Buffer

Access to the Buffer API that is packaged with diffusion.

This can be used in browsers that don't have a native Buffer class. It allows the creation of buffers for use with binary datatypes.

example
const buf = diffusion.buffer.from('Hello World', 'utf8')

Type declaration

  • constructor: function
    • new __type(str: string, encoding?: undefined | string): Buffer
    • new __type(size: number): Buffer
    • new __type(array: Uint8Array): Buffer
    • new __type(arrayBuffer: ArrayBuffer): Buffer
    • new __type(array: any[]): Buffer
    • new __type(buffer: Buffer): Buffer
    • Allocates a new buffer containing the given {str}.

      Parameters

      • str: string

        String to store in buffer.

      • Optional encoding: undefined | string

        encoding to use, optional. Default is 'utf8'

      Returns Buffer

    • Allocates a new buffer of {size} octets.

      Parameters

      • size: number

        count of octets to allocate.

      Returns Buffer

    • Allocates a new buffer containing the given {array} of octets.

      Parameters

      • array: Uint8Array

        The octets to store.

      Returns Buffer

    • Produces a Buffer backed by the same allocated memory as the given {ArrayBuffer}.

      Parameters

      • arrayBuffer: ArrayBuffer

        The ArrayBuffer with which to share memory.

      Returns Buffer

    • Allocates a new buffer containing the given {array} of octets.

      Parameters

      • array: any[]

        The octets to store.

      Returns Buffer

    • Copies the passed {buffer} data onto a new {Buffer} instance.

      Parameters

      • buffer: Buffer

        The buffer to copy.

      Returns Buffer

  • poolSize: number

    This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified.

  • prototype: Buffer
  • alloc: function
    • alloc(size: number, fill?: string | Buffer | number, encoding?: undefined | string): Buffer
    • Allocates a new buffer of {size} octets.

      Parameters

      • size: number

        count of octets to allocate.

      • Optional fill: string | Buffer | number

        if specified, buffer will be initialized by calling buf.fill(fill). If parameter is omitted, buffer will be filled with zeros.

      • Optional encoding: undefined | string

        encoding used for call to buf.fill while initalizing

      Returns Buffer

  • allocUnsafe: function
    • allocUnsafe(size: number): Buffer
    • Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents of the newly created Buffer are unknown and may contain sensitive data.

      Parameters

      • size: number

        count of octets to allocate

      Returns Buffer

  • allocUnsafeSlow: function
    • allocUnsafeSlow(size: number): Buffer
    • Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents of the newly created Buffer are unknown and may contain sensitive data.

      Parameters

      • size: number

        count of octets to allocate

      Returns Buffer

  • byteLength: function
    • byteLength(string: string | Buffer | DataView | ArrayBuffer, encoding?: undefined | string): number
    • Gives the actual byte length of a string. encoding defaults to 'utf8'. This is not the same as String.prototype.length since that returns the number of characters in a string.

      Parameters

      • string: string | Buffer | DataView | ArrayBuffer

        string to test. (TypedArray is also allowed, but it is only available starting ES2017)

      • Optional encoding: undefined | string

        encoding used to evaluate (defaults to 'utf8')

      Returns number

  • compare: function
    • compare(buf1: Buffer, buf2: Buffer): number
    • The same as buf1.compare(buf2).

      Parameters

      • buf1: Buffer
      • buf2: Buffer

      Returns number

  • concat: function
    • concat(list: Buffer[], totalLength?: undefined | number): Buffer
    • Returns a buffer which is the result of concatenating all the buffers in the list together.

      If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. If the list has exactly one item, then the first item of the list is returned. If the list has more than one item, then a new Buffer is created.

      Parameters

      • list: Buffer[]

        An array of Buffer objects to concatenate

      • Optional totalLength: undefined | number

        Total length of the buffers when concatenated. If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.

      Returns Buffer

  • from: function
    • from(arrayBuffer: ArrayBuffer, byteOffset?: undefined | number, length?: undefined | number): Buffer
    • from(data: any[] | string | Buffer | ArrayBuffer): Buffer
    • from(str: string, encoding?: undefined | string): Buffer
    • When passed a reference to the .buffer property of a TypedArray instance, the newly created Buffer will share the same allocated memory as the TypedArray. The optional {byteOffset} and {length} arguments specify a memory range within the {arrayBuffer} that will be shared by the Buffer.

      Parameters

      • arrayBuffer: ArrayBuffer

        The .buffer property of a TypedArray or a new ArrayBuffer()

      • Optional byteOffset: undefined | number
      • Optional length: undefined | number

      Returns Buffer

    • Creates a new Buffer using the passed {data}

      Parameters

      • data: any[] | string | Buffer | ArrayBuffer

        data to create a new Buffer

      Returns Buffer

    • Creates a new Buffer containing the given JavaScript string {str}. If provided, the {encoding} parameter identifies the character encoding. If not provided, {encoding} defaults to 'utf8'.

      Parameters

      • str: string
      • Optional encoding: undefined | string

      Returns Buffer

  • isBuffer: function
    • isBuffer(obj: any): boolean
    • Returns true if {obj} is a Buffer

      Parameters

      • obj: any

        object to test.

      Returns boolean

  • isEncoding: function
    • isEncoding(encoding: string): boolean
    • Returns true if {encoding} is a valid encoding argument. Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'

      Parameters

      • encoding: string

        string to test.

      Returns boolean

Const build

build: string = "10#849a77dc"

The build version of this client library

Const clients

clients: ClientControlOptionsNamespace = ClientControlOptions

Access to PropertyKeys

Const datatypes

datatypes: DataTypes = DataTypesImpl

Access to the datatypes namespace

Const errors

errors: object = ErrorReason

The ErrorReason enum

Type declaration

Const keys

keys: string[] = ['PUBLISH_VALUES_ONLY','SCHEMA','VALIDATE_VALUES','SLAVE_MASTER_TOPIC','TIDY_ON_UNSUBSCRIBE','TIME_SERIES_EVENT_VALUE_TYPE','TIME_SERIES_RETAINED_RANGE','TIME_SERIES_SUBSCRIPTION_RANGE','DONT_RETAIN_VALUE','PERSISTENT','REMOVAL','OWNER','COMPRESSION','CONFLATION','PRIORITY',]

Valid TopicSpecification keys

Const locks

locks: SessionLockOptionsNamespace = SessionLockOptions

Access to the locks namespace

Const selectors

selectors: TopicSelectors = new TopicSelectors()

Access to the selectors namespace

Const topicUpdate

topicUpdate: TopicUpdateNamespace = TopicUpdateNamespace

Access to the topicUpdate namespace

Const topics

topics: TopicsNamespace = topicsNamespace

Access to the topics namespace

Const version

version: string = "6.4.10"

The version of this client library in the form major.minor.patch

Functions

connect

  • Connect to a specified Diffusion server. This will return a Result that will complete succesfully if a session can be connected, or fail if an error was encountered.

    If the result is succesful, the fulfilled handler will be called with a Session instance. This session will be in a connected state and may be used for subsequent API calls.

    If the result fails, the rejected handler will be called with an error reason.

    Example:

    diffusion.connect('example.server.com').then(function(session) {
        // Connected with a session
        console.log('Connected!', session);
    }, function(error) {
        // Connection failed
        console.log('Failed to connect', error);
    });

    Parameters

    • options: Options

      the options to construct the session with.

    Returns Result<Session>

    a Result for this operation

escape

  • escape(s: string): string
  • Escapes special characters in a string that is to be used within a topic property or a session filter.

    This is a convenience method which inserts an escape character '' before any of the special characters ' " or .

    since

    6.1

    Parameters

    • s: string

      the string to be escaped

    Returns string

    the string value with escape characters inserted as appropriate

log

  • log(level: LogLevel | keyof LogLevel): void
  • Set the level of logging used by Diffusion. This will default to silent. Log levels are strings that represent different degrees of information to be logged. Available options are:

    • silent
    • error
    • warn
    • info
    • debug
    • trace

    Parameters

    • level: LogLevel | keyof LogLevel

      the log level to use

    Returns void

rolesToString

  • rolesToString(roles: Set<string> | string[]): string
  • Utility method which converts a set of authorisation roles to the string format required by the $Roles session property.

    since

    6.2

    Parameters

    • roles: Set<string> | string[]

      a set of roles

    Returns string

    a string representing the supplied roles, formatted as required by the $Roles session property

stringToRoles

  • stringToRoles(s: string): Set<string>
  • Utility method which converts a string of the format required by the $Roles session property into a mutable set of strings.

    since

    6.2

    Parameters

    • s: string

      the string with quoted roles separated by whitespace or commas

    Returns Set<string>

    set of roles

updateConstraints

  • Returns an update constraint factory.

    function

    diffusion#updateConstraints

    since

    6.2

    Returns UpdateConstraintFactory

    update constraint factory

Object literals

Const ClientControlOptions

ClientControlOptions: object

ANONYMOUS

ANONYMOUS: string = ""

Value returned by Session.getPrincipal if no principal name is associated with the session.

AddressType

AddressType: AddressType = AddressType

ClientType

ClientType: ClientType = ClientType

CloseReason

CloseReason: object = CloseReasonEnum

Type declaration

DetailType

DetailType: DetailType = DetailType

PropertyKeys

PropertyKeys: object = Object.freeze({/*** This constant can be used instead of a property key in requests for* session property values to indicate that <b>all</b> fixed session* properties are required.*/ALL_FIXED_PROPERTIES: ['*F'],/*** This constant can be used instead of a property key in requests for* session property values to indicate that <b>all</b> user defined session* properties are required.*/ALL_USER_PROPERTIES: ['*U'],/*** This constant can be used instead of a property key in requests for* session property values to indicate that <b>all</b> session* properties are required.*/ALL_PROPERTIES: ['*F', '*U'],/*** Session property key for session identifier.** @since 6.2*/SESSION_ID: '$SessionId',/*** Session property key for principal.** @since 6.2*/PRINCIPAL: '$Principal',/*** Session property key for connector name.** @since 6.2*/CONNECTOR: '$Connector',/*** Session property key for transport.** @since 6.2*/TRANSPORT: '$Transport',/*** Session property key for client type.** @since 6.2*/CLIENT_TYPE: '$ClientType',/*** Session property key for country code.** @since 6.2*/COUNTRY: '$Country',/*** Session property key for language code.** @since 6.2*/LANGUAGE: '$Language',/*** Session property key for server name.** @since 6.2*/SERVER_NAME: '$ServerName',/*** Session property key for client IP address.** @since 6.2*/CLIENT_IP: '$ClientIP',/*** Session property key for client latitude.** @since 6.2*/LATITUDE: '$Latitude',/*** Session property key for client longitude.** @since 6.2*/LONGITUDE: '$Longitude',/*** Session property key for client start time.** @since 6.2*/START_TIME: '$StartTime',/*** Session property key for session roles.** @since 6.2*/ROLES: '$Roles'})

Dictionary containing standard session property keys

Example:

// Get the ALL_FIXED_PROPERTIES key
var props = diffusion.clients.PropertyKeys.ALL_FIXED_PROPERTIES;

Example:

// Get all user and fixed properties
var props = diffusion.clients.PropertyKeys.ALL_FIXED_PROPERTIES
     .concat(diffusion.clients.PropertyKeys.ALL_USER_PROPERTIES);

Type declaration

TransportType

TransportType: TransportType = TransportType

Const CloseReasonEnum

CloseReasonEnum: object

Enum representing the reason that the session has been closed.

Example:

diffusion.connect({...}).then(function(session) {...}, function(err) {
  switch(err) {
      case diffusion.clients.CloseReason.CLOSED_BY_CLIENT:
      // Do something
      case diffusion.clients.CloseReason.ACCESS_DENIED:
      // Do something else
      ...
  }
});

ACCESS_DENIED

ACCESS_DENIED: CloseReasonImpl = new CloseReasonImpl(99, 'The connection attempt was rejected by the server because authentication failed', false)

The connection attempt failed due to a security restraint.

CLOSED_BY_CLIENT

CLOSED_BY_CLIENT: CloseReasonImpl = new CloseReasonImpl(0, 'The session was closed by the client', false)

The session has been closed by the client.

CLOSED_BY_SERVER

CLOSED_BY_SERVER: CloseReasonImpl = new CloseReasonImpl(1, 'The session was closed by the server', false)

The session has been closed by the server, or another session using the ClientControl feature.

CONNECTION_ERROR

CONNECTION_ERROR: CloseReasonImpl = new CloseReasonImpl(7, 'The client could not establish a connection to the server', true)

The client could not establish a connection to the server.

CONNECTION_TIMEOUT

CONNECTION_TIMEOUT: CloseReasonImpl = new CloseReasonImpl(3, 'The connection attempt timed out', false)

The connection attempt timed out.

HANDSHAKE_ERROR

HANDSHAKE_ERROR: CloseReasonImpl = new CloseReasonImpl(5, 'There was an error parsing the handshake response', false)

There was an error parsing the handshake response

HANDSHAKE_REJECTED

HANDSHAKE_REJECTED: CloseReasonImpl = new CloseReasonImpl(4, 'The connection handshake was rejected by the server', false)

The connection handshake was rejected by the server.

IDLE_CONNECTION

IDLE_CONNECTION: CloseReasonImpl = new CloseReasonImpl(8, 'The activity monitor detected the connection was idle', true)

The client detected that the connection was idle.

LICENSE_EXCEEDED

LICENSE_EXCEEDED: CloseReasonImpl = new CloseReasonImpl(18, 'The license limit was exceeded', false)

The connection request was rejected because the license limit was reached

LOST_MESSAGES

LOST_MESSAGES: CloseReasonImpl = new CloseReasonImpl(16, 'Loss of messages has been detected', false)

Message loss after reconnection has been detected.

PROTOCOL_VERSION_MISMATCH

PROTOCOL_VERSION_MISMATCH: CloseReasonImpl = new CloseReasonImpl(17, 'There was a mismatch in the protocol versions', false)

The handshake response contained an incompatible protocol version

RECONNECT_ABORTED

RECONNECT_ABORTED: CloseReasonImpl = new CloseReasonImpl(2, 'Client aborted a reconnect attempt', false)

Whilst disconnected, the client explicitly aborted a reconnect attempt/

TRANSPORT_ERROR

TRANSPORT_ERROR: CloseReasonImpl = new CloseReasonImpl(6, 'There was an unexpected error with the connection', true)

There was an unexpected error with the network connection.

Const ErrorReason

ErrorReason: object

Enum containing reason codes used to report error conditions.

Some common ErrorReason values are defined as global constants. More specific reasons may be defined by individual features.

Example:

// Handle an error from the server
session.addStream('foo', diffusion.datatypes.string()).on('error', function(e) {
    if (e == diffusion.errors.ACCESS_DENIED) {
        // Handle authorisation error
    } else {
        // Log the problem
        console.log(e);
    }
});

ACCESS_DENIED

ACCESS_DENIED: ErrorReason = new ErrorReasonImpl(103, 'Access denied')

The request was rejected because the caller has insufficient permissions.

CALLBACK_EXCEPTION

CALLBACK_EXCEPTION: ErrorReason = new ErrorReasonImpl(105, 'An application callback threw an exception. Check logs for more information')

An application callback threw an exception. Check logs for more information.

COMMUNICATION_FAILURE

COMMUNICATION_FAILURE: ErrorReason = new ErrorReasonImpl(100, 'Communication with server failed')

Communication with the server failed.

HANDLER_CONFLICT

HANDLER_CONFLICT: ErrorReason = new ErrorReasonImpl(201, 'Conflict with an existing handler')

A conflicting registration exists on the server.

INCOMPATIBLE_DATATYPE

INCOMPATIBLE_DATATYPE: ErrorReason = new ErrorReasonImpl(108, 'Data type is incompatible')

An operation failed due to using an incompatible data type.

INVALID_DATA

INVALID_DATA: ErrorReason = new ErrorReasonImpl(106, 'Invalid data')

An operation failed because invalid data was received.

INVALID_PATH

INVALID_PATH: ErrorReason = new ErrorReasonImpl(202, 'Invalid path')

An invalid path was supplied.

NO_SUCH_SESSION

NO_SUCH_SESSION: ErrorReason = new ErrorReasonImpl(107, 'A requested session could not be found')

An operation failed because an addressed session could not be found.

REJECTED_REQUEST

REJECTED_REQUEST: ErrorReason = new ErrorReasonImpl(9003, 'A request has been rejected by the recipient session')

A recipient session has rejected a received message request.

REQUEST_TIME_OUT

REQUEST_TIME_OUT: ErrorReason = new ErrorReasonImpl(102, 'Request time out')

Communication with the server failed because a service request timed out.

SESSION_CLOSED

SESSION_CLOSED: ErrorReason = new ErrorReasonImpl(101, 'Session is closed')

Communication with the server failed because the session is closed.

TOPIC_TREE_REGISTRATION_CONFLICT

TOPIC_TREE_REGISTRATION_CONFLICT: ErrorReason = new ErrorReasonImpl(200, 'A conflicting registration exists on the same branch of the topic tree')

A conflicting registration exists on the same branch of the topic tree.

UNHANDLED_MESSAGE

UNHANDLED_MESSAGE: ErrorReason = new ErrorReasonImpl(109, 'A message was not handled')

A sent message was not handled by the specified recipient.

UNSUPPORTED

UNSUPPORTED: ErrorReason = new ErrorReasonImpl(104, 'Unsupported service')

The request was rejected because the requested operation is unsupported for this caller.

Const SessionLockOptions

SessionLockOptions: object

SessionLockScope

SessionLockScope: SessionLockScope = SessionLockScope

Const TopicAddFailReasonEnum

TopicAddFailReasonEnum: object

The reason that a topic could not be added.

Example:

session.topics.add('foo').then(function() { ... }, function(err) {
    switch (err) {
         case diffusion.topics.TopicAddFailReason.EXISTS:
             ...
         case diffusion.topics.TopicAddFailReason.INVALID_PATH:
             ...
    }
});

CLUSTER_REPARTITION

CLUSTER_REPARTITION: TopicAddFailReason = new TopicAddFailReason(10, 'When trying to create the topic the cluster was migrating the partition that owns the topic')

When trying to create the topic the cluster was migrating the partition that owns the topic. The correct owner could not be identified and the request failed. This is a transient failure for the duration of the partition migration.

EXCEEDED_LICENSE_LIMIT

EXCEEDED_LICENSE_LIMIT: TopicAddFailReason = new TopicAddFailReason(11, 'Adding the topic failed because of a license limit')

Adding the topic failed because of a license limit.

EXISTS

EXISTS: TopicAddFailReason = new TopicAddFailReason(1, 'The topic already exists with the same details')

The topic already exists with the same details.

EXISTS_INCOMPATIBLE

EXISTS_INCOMPATIBLE: TopicAddFailReason = new TopicAddFailReason(14, 'Adding the topic failed because a topic is already bound to the specified' +'path but the caller does not have the rights to manage it')

Adding the topic failed because a topic is already bound to the specified path but the caller does not have the rights to manage it.

This can be because the topic is being managed by a component with exclusive control over the topic, such as fan-out or a publisher and thus the caller will not be able to update or remove the topic.

If the caller has suitable permissions then it could still subscribe to the topic, but the topic's specification may be different from that requested.

EXISTS_MISMATCH

EXISTS_MISMATCH: TopicAddFailReason = new TopicAddFailReason(2, 'The topic already exists, with different details')

The topic already exists, with different details.

INCOMPATIBLE_MASTER

INCOMPATIBLE_MASTER: TopicAddFailReason = new TopicAddFailReason(13, 'Adding a slave topic failed because a topic owned by a publisher' +'is already bound to the specified master path.')

Adding a slave topic failed because a topic owned by a publisher is already bound to the specified master path.

deprecated

Since 6.4

Slave topics are deprecated. This value will be removed in a future release.

INCOMPATIBLE_PARENT

INCOMPATIBLE_PARENT: TopicAddFailReason = new TopicAddFailReason(12, 'Adding the topic failed because a topic owned by a publisher is already bound to the parent path')

Adding the topic failed because a topic owned by a publisher is already bound to the parent path.

INITIALISE_ERROR

INITIALISE_ERROR: TopicAddFailReason = new TopicAddFailReason(8, 'The topic could not be initialised, supplied value may be of the wrong format')

The topic could not be initialised, supplied value may be of the wrong format. Deprecation notice

This value is associated only with removed methods that allow the specification of an initial value when creating a topic. It will be removed in a future release.

deprecated

Since 6.1

INVALID_DETAILS

INVALID_DETAILS: TopicAddFailReason = new TopicAddFailReason(4, 'The topic details are invalid')

The topic details are invalid.

INVALID_NAME

INVALID_NAME: TopicAddFailReason = new TopicAddFailReason(15, 'The supplied topic path is invalid.')

The supplied topic path is invalid.

INVALID_PATH

INVALID_PATH: TopicAddFailReason = new TopicAddFailReason(3, 'The topic path is invalid')

The topic path is invalid.

PERMISSIONS_FAILURE

PERMISSIONS_FAILURE: TopicAddFailReason = new TopicAddFailReason(7, 'Invalid permissions to add a topic at the specified path')

Invalid permissions to add a topic at the specified path.

TOPIC_NOT_FOUND

TOPIC_NOT_FOUND: TopicAddFailReason = new TopicAddFailReason(6, 'A referenced topic could not be found')

A referenced topic could not be found.

UNEXPECTED_ERROR

UNEXPECTED_ERROR: TopicAddFailReason = new TopicAddFailReason(9, 'An unexpected error occured while creating the topic')

An unexpected error occured while creating the topic.

USER_CODE_ERROR

USER_CODE_ERROR: TopicAddFailReason = new TopicAddFailReason(5, 'A user supplied class could not be found or instantiated')

A user supplied class could not be found or instantiated. Deprecation notice

This value is associated only with removed methods that create topics. It will be removed in a future release.

deprecated

Since 6.2

Const TopicTypeEnum

TopicTypeEnum: object

Enum containing possible Topic Types.

Example:

// Get a topic type for adding topics
var topicType = diffusion.topics.TopicType.JSON;

session.topics.add("foo", topicType);

BINARY

BINARY: TopicType = new TopicType(14, true, false)

Binary Topic.

This is a stateful topic that handles data in Binary format.

since

5.7

DOUBLE

DOUBLE: TopicType = new TopicType(19, true, false)

Topic that stores and publishes IEEE 754 double-precision floating point numbers (i.e native JavaScript Numbers). Based on the double data type.

Supports null Double values.

The topic does not support delta-streams - only complete values are transmitted.

since

6.0

INT64

INT64: TopicType = new TopicType(18, true, false)

Topic that stores and publishes 64-bit integer values. Based on the int64 data type. Values are of the type Int64.

Supports null int64 values.

Does not support delta-streams - only complete values are transmitted.

since

6.0

JSON

JSON: TopicType = new TopicType(15, true, false)

JSON (JavaScript Object Notation) Topic.

This is a stateful topic that handles data in JSON representation.

since

5.7

RECORD_V2

RECORD_V2: TopicType = new TopicType(20, true, false)

Topic that stores and publishes data in the form of records and fields. Based on the RecordV2 data type.

Supports delta-streams.

since

6.0

ROUTING

ROUTING: TopicType = new TopicType(12, false, true)

Routing Topic.

A functional topic that can point to different target topics for different clients.

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.

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.

SLAVE

SLAVE: TopicType = new TopicType(7, true, false)

Slave Topic.

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.

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.

Any number of slave topics may reference the same master topic.

If a topic is removed that referenced by slave topics, all such slave topics are also automatically removed.

Slave topics are unable to be created by the Javascript client, but may safely be subscribed to.

STRING

STRING: TopicType = new TopicType(17, true, false)

Topic that stores and publishes String values. Based on the string data type.

Supports null String values.

Supports delta-streams.

since

6.0

TIME_SERIES

TIME_SERIES: TopicType = new TopicType(16, true, false)

Time Series Topic.

A time series is a sequence of events. Each event contains a value and has server-assigned metadata comprised of a sequence number, timestamp, and author.

A time series topic allows sessions to access a time series that is maintained by the server. A time series topic has an associated event data type, such as Binary, String, or JSON, that determines the type of value associated with each event.

Retained range

The 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.

Subscription range

The 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 range query.

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 Subscription range in the Session.timeseries time series feature} documentation.

Mandatory properties

The TIME_SERIES_EVENT_VALUE_TYPE property must be provided when creating a time series topic.

since

6.0

see

diffusion.datatypes.TimeSeriesDataType

UNKNOWN_TOPIC_TYPE

UNKNOWN_TOPIC_TYPE: TopicType = new TopicType(21, false, false)

A topic type that is unsupported by the session.

since

6.3

Const TopicUpdateNamespace

TopicUpdateNamespace: object

TopicCreationResult

TopicCreationResult: TopicCreationResult = TopicCreationResult

Const UnsubscribeReasonEnum

UnsubscribeReasonEnum: object

Enum containing reasons that an unsubscription occurred.

Example:

// Use UnsubscribeReason to validate unsubscription notifications
session.addStream('>foo', diffusion.datatypes.string())
       .on('unsubscribe', function(topic, specification, reason) {
    switch (reason) {
        case diffusion.topics.UnsubscribeReason.REMOVED :
            // Do something if the topic was removed
        default :
            // Do something else if the client was explicitly unsubscribed
    }
});

AUTHORIZATION

AUTHORIZATION: UnsubscribeReason = new UnsubscribeReason(3, 'Not authorized to subscribe to this topic')

The unsubscription occurred because the session is no longer authorized to access the topic.

since

5.9

BACK_PRESSURE

BACK_PRESSURE: UnsubscribeReason = new UnsubscribeReason(5, 'The server has unsubscribed due to a backlog of messages')

The server has a significant backlog of messages for the session, and the topic specification has the conflation topic property set to 'unsubscribe'. The session can resubscribe to the topic. The unsubscription is not persisted to the cluster. If the session fails over to a different server it will be resubscribed to the topic.

since

6.1

CONTROL

CONTROL: UnsubscribeReason = new UnsubscribeReason(1, 'The server or another client unsubscribed this client')

The server or another client unsubscribed this client.

REMOVED

REMOVED: UnsubscribeReason = new UnsubscribeReason(2, 'The topic was removed')

The topic was removed

REQUESTED

REQUESTED: UnsubscribeReason = new UnsubscribeReason(0, 'The unsubscription was requested by this client')

The unsubscription was requested by this client.

STREAM_CHANGE

STREAM_CHANGE: UnsubscribeReason = new UnsubscribeReason(undefined, 'A more specific stream has been registered to the same path')

A fallback stream has been unsubscribed or subscribed due to the addition or removal of a stream that selects the topic.

since

5.9

SUBSCRIPTION_REFRESH

SUBSCRIPTION_REFRESH: UnsubscribeReason = new UnsubscribeReason(undefined, 'The server has re-subscribed this session')

The server has re-subscribed this session to the topic. Existing streams are unsubscribed because the topic type and other attributes may have changed.

This can happen if a set of servers are configured to use session replication, and the session connected to one server reconnects ('fails over') to a different server.

A stream that receives an unsubscription notification with this reason will also receive a subscription notification with the new TopicSpecification.

since

5.9

UNKNOWN_UNSUBSCRIBE_REASON

UNKNOWN_UNSUBSCRIBE_REASON: UnsubscribeReason = new UnsubscribeReason(4, 'Unknown unsubscribe reason')

A reason that is unsupported by the session.

since

6.1

Const UpdateFailReasonEnum

UpdateFailReasonEnum: object

The reason that a topic could not be updated.

Example:

session.topics.update('foo', 'bar').then(function() { ... }, function(err) {
    switch (err) {
        case diffusion.topics.UpdateFailReason.MISSING_TOPIC:
            ...
        case diffusion.topics.UpdateFailReason.EXCLUSIVE_UPDATER_CONFLICT:
            ...
    }
});

CLUSTER_REPARTITION

CLUSTER_REPARTITION: UpdateFailReason = new UpdateFailReason(9, 'When trying to update the topic the cluster was migrating the partition that owns the topic')

An update to a replicated topic failed because the cluster was repartitioning due to a server starting, stopping, or failing. The session can retry the operation.

DELTA_WITHOUT_VALUE

DELTA_WITHOUT_VALUE: UpdateFailReason = new UpdateFailReason(8, 'An attempt has been made to apply a delta to a topic that does not yet have a value')

An attempt has been made to apply a delta to a topic that has not yet has a value specified for it.

DUPLICATES

DUPLICATES: UpdateFailReason = new UpdateFailReason(6, 'Duplicates violation')

Violation of content duplication restrictions.

EXCLUSIVE_UPDATER_CONFLICT

EXCLUSIVE_UPDATER_CONFLICT: UpdateFailReason = new UpdateFailReason(7, 'An exclusive update source is already registered for the topic branch')

Attempt to perform a non-exclusive update to a topic branch that already has an update source registered to it.

INCOMPATIBLE_STATE

INCOMPATIBLE_STATE: UpdateFailReason = new UpdateFailReason(10, 'An update could not be performed because the topic is managed by' +'a component (e.g fan-out) that prohibits updates from the caller')

An update could not be performed because the topic is managed by a component (e.g fan-out) that prohibits updates from the caller.

INCOMPATIBLE_UPDATE

INCOMPATIBLE_UPDATE: UpdateFailReason = new UpdateFailReason(1, 'Update type is incompatible with topic type')

The update was of a type that is not compatible with the topic it was submitted for, or the topic does not support updating.

INVALID_ADDRESS

INVALID_ADDRESS: UpdateFailReason = new UpdateFailReason(5, 'Key or index value is invalid for topic data')

Invalid key or index used for addressing topic content.

INVALID_UPDATER

INVALID_UPDATER: UpdateFailReason = new UpdateFailReason(3, 'Updater is invalid for updating')

The updater used is not active.

MISSING_TOPIC

MISSING_TOPIC: UpdateFailReason = new UpdateFailReason(4, 'Topic does not exist')

The topic being updated does not exist.

UPDATE_FAILED

UPDATE_FAILED: UpdateFailReason = new UpdateFailReason(2, 'Update failed - possible content incompatibility')

The update failed, possibly because the content sent with the update was invalid/incompatible with topic type or data format.

Const topicsNamespace

topicsNamespace: object

FetchRequest

FetchRequest: FetchRequest = FetchRequest

TopicAddFailReason

TopicAddFailReason: object = TopicAddFailReasonEnum

Type declaration

TopicSpecification

TopicSpecification: TopicSpecification = TopicSpecification

TopicType

TopicType: object = TopicTypeEnum

Type declaration

UnsubscribeReason

UnsubscribeReason: object = UnsubscribeReasonEnum

Type declaration

UpdateFailReason

UpdateFailReason: object = UpdateFailReasonEnum

Type declaration