Class MessagingREST.Client
Defined in: restmsg.js.
Constructor Attributes | Constructor Name and Description |
---|---|
MessagingREST.Client(host, port, path, clientid, username, password)
The JavaScript application communicates with IBM MessageSight via http plug-in using
a MessagingREST.Client object.
|
Method Attributes | Method Name and Description |
---|---|
createTopicSubscription(topicName, persist, retain, onSuccess, onFailure)
Publish a message to a specific topic.
|
|
deleteRetained(topicName, onSuccess, onFailure)
Invoke action to delete retained message from a
given topic.
|
|
getRetainedMsg(topicName, onSuccess, onFailure)
Invoke action to obtain retained messages from topic.
|
Class Detail
MessagingREST.Client(host, port, path, clientid, username, password)
The JavaScript application communicates with IBM MessageSight via http plug-in using
a MessagingREST.Client object.
The methods are implemented as asynchronous JavaScript methods (even though the
underlying protocol exchange might be synchronous in nature). This means they signal
their completion by calling back to the application via Success or Failure callback
functions provided by the application on the method in question. These callbacks are
called at most once per method invocation and do not persist beyond the lifetime of
the script that made the invocation.
- Parameters:
- {string} host
- - the address of the IBM MessageSight host, as a DNS name or dotted decimal IP address.
- {number} port
- - the port number to connect to
- {string} path
- - the alias on the IBM MessageSight host.
- {string} clientid
- - the MessagingREST client identifier
- {string} username
- - the username to authenticate with
- {string} password
- - the password for the username provided
Method Detail
createTopicSubscription(topicName, persist, retain, onSuccess, onFailure)
Publish a message to a specific topic.
- Parameters:
- {string} topicName
- - the topic filter that the subscription should be set to
- {boolean} persist
- - if the message should persist
- {boolean} retain
- - if the message should be retained
- {function} onSuccess
- - Called after a response with a status code of 200 is received
from the server. A single response parameter is passed
to the onSuccess callback:
- a string that contains any response from the request
- {function} onFailure
- - Called when a status code other than 200 is received from
the server. Two response parameters are passed to the
onFailure callback:
- a number that indicates the response code from the server
- a string that contains any response text from the server
deleteRetained(topicName, onSuccess, onFailure)
Invoke action to delete retained message from a
given topic.
- Parameters:
- {string} topicName
- - The topic that the retained message should be removed from.
- {function} onSuccess
- - Called after a response with a status code of 200 is received
from the server. A single response parameter is passed
to the onSuccess callback:
- a string that contains any response from the request
- {function} onFailure
- - Called when a status code other than 200 is received from
the server. Two response parameters are passed to the
onFailure callback:
- a number that indicates the response code from the server
- a string that contains any response text from the server
getRetainedMsg(topicName, onSuccess, onFailure)
Invoke action to obtain retained messages from topic.
This API will invoke an asynchronous call on the IBM
MessageSight server that will attempt to obtain a retained
message. After successful callback from this API a check
for the retained message can be done with a call to
MessagingREST.Client#retrieveMessages
- Parameters:
- {string} topicName
- - The topic name to obtain a retained message from.
- {function} onSuccess
- - Called after a response with a status code of 200 is received
from the server. A single response parameter is passed
to the onSuccess callback:
- a string that contains the topic
- a string that contains any response from the request
- {function} onFailure
- - Called when a status code other than 200 is received from
the server. Two response parameters are passed to the
onFailure callback:
- a number that indicates the response code from the server
- a string that contains any response text from the server