Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Message

This is the AMPS Message representation class. Any Message received from AMPS is a Message object.

Message have two main fields: header and data. The header property is used to access message header fields, such as command type, message length, sow key, etc. The data fields contains the message payload.

const messageHandler = message => {
    // print out the command type
    console.log(message.header.command());

    // get the subscription id of the message
    console.log(message.header.subId());

    // print out message data
    console.log(message.data);
};
see

MessageHeader for the list of available header methods.

Hierarchy

  • Header
    • Message

Index

Properties

a

a: string

Acknowledgement type for the given command.

deprecated

Use MessageHeader.ackType method instead.

bm

bm: string

A client-originated identifier used to mark a location in journaled messages.

deprecated

Use MessageHeader.bookmark method instead.

bs

bs: number

Specifies the number of messages that are batched together when returning a query result.

deprecated

Use MessageHeader.batchSize method instead.

c

c: string

Command to be executed. Can be one of:

  • publish
  • subscribe
  • subscribe
  • sow_and_subscribe
  • sow_delete
  • unsubscribe
  • flush
  • heartbeat
  • start_timer
  • stop_timer
  • logon
deprecated

Use MessageHeader.command method instead.

cid

cid: string

Client-specified command id. The command id is returned by the engine in responses to commands to allow the client to correlate the response to the command.

deprecated

Use MessageHeader.commandId method instead.

client_name

client_name: string

Used to identify a client. Useful for publishers that wish to identify the source of a publish, client status messages and for client heartbeats. Can be set with logon command.

deprecated

Use MessageHeader.clientName method instead.

data

data: any

Message data. Contains message payload parsed according with its message type and the TypeHelper used for that type.

e

e: number

SOW expiration time (in seconds) if used in publish.

deprecated

Use MessageHeader.expiration method instead.

filter

filter: string

Content filter expression.

deprecated

Use MessageHeader.filter method instead.

gseq

gseq: number

Group Sequence Number returned with each batch message of a SOW response.

deprecated

Use MessageHeader.groupSequenceNumber method instead.

header

Message header fields, such as command(), subId(), filter(), etc.

k

k: string

A SowKey will accompany each message returned in an SOW batch. A SowKey may also be added to messages coming in on a subscription when the published message matches a record in the SOW. A publish command may contain a SOW key if the SOW for the topic is configured to accept user-provided SOW keys.

Format:

  • string containing the digits of an unsigned long for AMPS-generated SOW keys

OR

  • arbitrary string in the base64 character set for user-provided SOW keys.
deprecated

Use MessageHeader.sowKey method instead.

l

l: number

Sent with XML formatted message data to indicate the number of bytes used by the message body.

deprecated

Use MessageHeader.messageLength method instead.

lp

lp: string

For messages from a queue, the time at which the lease expires.

deprecated

Use MessageHeader.leasePeriod method instead.

matches

matches: number

Returned in the acknowledgement to a SOW query that indicates number of matches.

deprecated

Use MessageHeader.matches method instead.

o

o: string
A comma-delimited list of options on a specific command. Also has an alias: `opts`.
deprecated

Use MessageHeader.options method instead.

orderby

orderby: string

The SOW topic key by which to order SOW query.

deprecated

Use MessageHeader.orderBy method instead.

query_id

query_id: string

SOW Query identifier set by client to identify a query.

deprecated

Use MessageHeader.queryId method instead.

reason

reason: string

The failure message that appears when an acknowledgement returns a status of failure.

deprecated

Use MessageHeader.reason method instead.

records_deleted

records_deleted: number

Used in conjunction with the stats acknowledgement, this is the number of records deleted from the SOW with a sow_delete command.

deprecated

Use MessageHeader.recordsDeleted method instead.

records_inserted

records_inserted: number

Used in conjunction with the stats acknowledgement, this is the number of records inserted into the SOW.

deprecated

Use MessageHeader.recordsInserted method instead.

records_returned

records_returned: number

Returned in the acknowledgement to an SOW query that indicates number of records in the store.

deprecated

Use MessageHeader.recordsReturned method instead.

records_updated

records_updated: number

Used in conjunction with the stats acknowledgement, this is the number of records updated in the SOW.

deprecated

Use MessageHeader.recordsUpdated method instead.

s

s: string

An integer that corresponds to the publish message sequence number. For more information see the Replication section in the User Guide. It is actually a big integer, but since it's received in the JSON header and is parsed before we can wrap it in the BigInteger object, it's treated as a string to prevent rounding issues with JavaScript.

deprecated

Use MessageHeader.sequenceId method instead.

sids

sids: string

Comma-separated list of SubIds sent from AMPS engine to identify which client subscriptions match a given publish message.

deprecated

Use MessageHeader.subIds method instead.

sow_keys

sow_keys: string

Comma-separated list of SowKey values.

deprecated

Use MessageHeader.sowKeys method instead.

status

status: string

Used to indicate client status when client is monitored for heartbeats. Can be one of:

  • stopped
  • alive
  • timed out
  • error
deprecated

Use MessageHeader.status method instead.

sub_id

sub_id: string

The subscription identifier set by server when processing a subscription.

deprecated

Use MessageHeader.subId method instead.

t

t: string

The Topic value.

deprecated

Use MessageHeader.topic method instead.

top_n

top_n: number

The number of records to return. Note: If TopN is not equally divisible by the batch size, then more records will be returned so that the total number of records is equally divisible by the batch size setting.

deprecated

Use MessageHeader.topN method instead.

topic_matches

topic_matches: number

Returned in the acknowledgement to an SOW query that indicates number of topic matches.

deprecated

Use MessageHeader.topicMatches method instead.

ts

ts: string

Message timestamp set by the server in a ISO-8601 date-time format.

deprecated

Use MessageHeader.timestamp method instead.

user_id

user_id: string

Used to identify the user id of a command.

deprecated

Use MessageHeader.userId method instead.

version

version: string

contains the version of the AMPS server.

deprecated

Use [[MessageHeader.version]] method instead.

x

x: string

Opaque token set by an application and returned with the message. Must be base64 encoded characters only.

deprecated

Use MessageHeader.correlationId method instead.