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(filter, subscriptionName, durable, onSuccess, onFailure)
Create a subscription for a given topic filter and a provided name.
|
|
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.
|
|
retrieveMessages(timeout, onSuccess, onFailure)
Obtain messages for current subscriptions.
|
|
sendDisconnect(timeout, onSuccess, onFailure)
Send an explicit disconnect request to IBM MessageSight
|
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(filter, subscriptionName, durable, onSuccess, onFailure)
Create a subscription for a given topic filter and a provided name.
- Parameters:
- {string} filter
- - the topic filter that the subscription should be set to
- {string} subscriptionName
- - the name of the subscription
- {boolean} durable
- - if the subscription is durable or not
- {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 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
retrieveMessages(timeout, onSuccess, onFailure)
Obtain messages for current subscriptions.
- Parameters:
- {number} timeout
- - The amount of time to wait for a message.
- {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
sendDisconnect(timeout, onSuccess, onFailure)
Send an explicit disconnect request to IBM MessageSight
- Parameters:
- {number} timeout
- - Amount of time that IBM MessageSight should wait for the request to complete.
- {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