Skip to main content
Version: 8.1

Accept the result from a subscriber module (address message)

Level: intermediate
Example

Implement the MessageWithResult address message in the module. The message must have the Publish direction and accept the result from a subscriber module.

Example that implements the MessageWithResult address message
...
/* Collection of the configuration message objects. */
messages: {
...
"MessageWithResult": {
mode: Terrasoft.MessageMode.PTP,
direction: Terrasoft.MessageDirectionType.PUBLISH
}
}
...
processMessages: function() {
...
/* Publish messages and receive the result of their handling by the subscriber module. */
var result = this.sandbox.publish("MessageWithResult", {arg1:5, arg2:"arg2"}, ["resultTag"]);
/* Display the result at the browser console. */
console.log(result);
}
...