Class: Message

olympe.dc. Message

A Message contains a data request to be processed by the data router and forwarded sources.


new Message(type, content, destinations)

Creates an instance of Message.

Parameters:
Name Type Description
type olympe.dc.Message.MessageType

Type of the message.

content Object | string

The content of the message.

destinations Array.<string>

The destinations for the message.

Members


<static> MessageType :number

List of message types that can be sent to the router

Type:
  • number
Properties:
Name Type Default Description
ERROR number 1
KEEP_ALIVE number 2
GET_CONTEXT number 10
GET_CONTEXT_ERROR number 11
SUBSCRIPTION_CREATE number 20
SUBSCRIPTION_SUBSCRIBE number 21
SUBSCRIPTION_UPDATE number 22
SUBSCRIPTION_UNSUBSCRIBE number 23
GRAPHDEF_SUBSCRIPTION number 24
GRAPHDEF_GET number 25
GRAPHDEF_UPDATE number 26
GRAPHDEF_UNSUBSCRIBE number 28
QUERY_EXECUTION number 30
QUERY_SUBSCRIPTION number 31
QUERY_UNSUBSCRIBE number 32
TRANSACTION_REQUEST number 40
TRANSACTION_REQUEST_HTTP number 41
BURST_TRANSACTION number 45
BURST_TRANSACTION_ERROR number 46
FINALIZE_TRANSACTION number 47
UPLOAD_FILE number 50
DOWNLOAD_FILE number 51
DELETE_FILE number 52
UNDO_TRANSACTION number 60
REDO_TRANSACTION number 61
GET_STACK number 62
GET_STACK_RESPONSE number 63
CLEAR_STACK number 64
BURST_TRANSACTION_DONE number 65
GENERIC_ACK number 90
DATA_NOTIFICATION number 91
GRAPH_RESULT number 92
GRAPH_NOTIFICATION number 93
LIST_NOTIFICATION number 94
NOTIFICATION_DONE number 95
SUBSCRIPTION_DONE number 96
QUERY_RESULT number 97
QUERY_RESULT_UPDATE number 98

Methods


getContent()

Gets the content of the message.

Returns:

The content.

Type
Object | string

getContext()

Return the context associated to this message

Returns:
Type
olympe.df.ExecutionContext

getDestinations()

Gets the destinations of the message.

Returns:

The destinations.

Type
Array.<string>

getType()

Gets the type of the message.

Returns:

The type.

Type
olympe.dc.Message.MessageType

onResponse(callback)

Register a ResponseCallback to be called when a response to this message is received.

Parameters:
Name Type Description
callback olympe.dc.Message.ValidationCallback

The function to call.

Returns:

this Message.

Type
olympe.dc.Message

setContext(context)

Override the context associated to that message

Parameters:
Name Type Description
context olympe.df.ExecutionContext
Returns:

this

Type
olympe.dc.Message

toString()

Returns:
Type
string

validate( [error])

Validate or not the message and triggers the response callback if specified for this message.

Parameters:
Name Type Argument Default Description
error Error <optional>
<nullable>
null

The error, or null for success.

Type Definitions


MessageHandler(source, content)

Function to call when we receive a message of a specific type.

Parameters:
Name Type Description
source string

the source id of the message

content *

the message content


ValidationCallback(error)

Function to be called when a response to a request is available. If an error occurred, it will be passed as an argument.

Parameters:
Name Type Argument Description
error Error <nullable>

The error or null for no error.