Class Index
static org.cote.js.message.MessageService
version 1.9.18
Instance of MessageService.
This class participates in the engine library.
org.cote.js.message.MessageServiceImpl
version 1.9.18
Service for sending messages, and sending and receiving publication broadcasts.
This class participates in the engine library.
Index
Object Index
- public MessageObject: Object published to onsendmessage subscribers when the sendMessage method is invoked.
Property Index
- public object_config (internal): Object API structure for storing sub structures: object_config.pointers and object_config.status.
- public object_id (internal): Unique instance identifier.
- public object_type (internal): The type of this object.
- public object_version (internal): Version of the object class.
- public ready_state (internal): Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.
Method Index
- private _delayPublish (internal): End action for a delayed publication. Cached message is sent directly on to publication.
- private _publish (internal): Publishes the specified data to registered subscribers.
- public clearEntries: Clears message entries.
- public flush: Clears delayed delivery cache.
- public getDeliveryDelay: Returns the delay in milliseconds between publication and delivery.
- public getObjectId: Returns the unique id of the object.
- public getObjectType: Returns the type of the object.
- public getObjectVersion: Returns the version of the object.
- public getPointers: Returns the object_config.pointers sub structure.
- public getReadyState: Returns the state of the object.
- public getStatus: Returns the object_config.status sub structure.
- public publish: Publishes the specified data to registered subscribers. If delayed delivery is in effect, caches the message data and sends it after the preset delay in milliseconds.
- public sendMessage: Sends the specified message as a MessageObject to all onsendmessage subscribers.
- public setDeliveryDelay: Sets the delay in milliseconds between publication and delivery.
- public setReportThreshold: Sets the report threshold for sendMessage.
- public sigterm: Termination signal indicating the message service should stop processing messages and subscriptions, and be prepared for destruction.
- public subscribe: Subscribes an object to receive message publications for the specified publication name.
- public unsubscribe: Unsubscribes an object from receiving message publications for the specified publication name.
Objects
MessageObject
Object published to onsendmessage subscribers when the sendMessage method is invoked.
Properties
- message as variant: Variant message body.
- level as int: The message threshold.
- description as String: Description of the message origination, if the message type code was mapped to an internal definition.
Properties
object_config
Object API structure for storing sub structures: object_config.pointers and object_config.status.
Syntax
object = object.object_config
object_id
Unique instance identifier.
Syntax
String = object.object_id
object_type
The type of this object.
Syntax
String = object.object_type
object_version
Version of the object class.
Syntax
String = object.object_version
ready_state
Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.
Syntax
int = object.ready_state
Methods
_delayPublish
End action for a delayed publication. Cached message is sent directly on to publication. Method is private and should not be directly referenced.
Syntax
void _delayPublish(
i
)
Parameters
- i as String : Identifier of the cached message item to be delivered for the corresponding subscribers.
_publish
Publishes the specified data to registered subscribers. Method is private and should not be directly referenced.
Syntax
void _publish(
e, v
)
Parameters
- e as String : The name of the publication.
- v as variant : Data being published.
clearEntries
Clears message entries.
Syntax
void clearEntries(
)
flush
Clears delayed delivery cache.
Syntax
void flush(
)
getDeliveryDelay
Returns the delay in milliseconds between publication and delivery.
Syntax
d = getDeliveryDelay(
)
Returns
d as int: Delay in milliseconds between publication and delivery.
getObjectId
Returns the unique id of the object.
Syntax
i = getObjectId(
)
Returns
i as String: The unique object instance id.
getObjectType
Returns the type of the object.
Syntax
t = getObjectType(
)
Returns
t as String: The type of the object instance.
getObjectVersion
Returns the version of the object.
Syntax
v = getObjectVersion(
)
Returns
v as String: The version of the object instance.
getPointers
Returns the object_config.pointers sub structure.
Syntax
o = getPointers(
)
Returns
o as object: The object_config.pointers substructure.
getReadyState
Returns the state of the object.
Syntax
s = getReadyState(
)
Returns
s as int: The object ready state.
getStatus
Returns the object_config.status sub structure.
Syntax
o = getStatus(
)
Returns
o as object: The object_config.status substructure.
publish
Publishes the specified data to registered subscribers. If delayed delivery is in effect, caches the message data and sends it after the preset delay in milliseconds.
Syntax
void publish(
e, v
)
Parameters
- e as String : The name of the publication.
- v as variant : Data being published.
sendMessage
Sends the specified message as a MessageObject to all onsendmessage subscribers.
Syntax
o = sendMessage(
d, s, p
)
Parameters
- d as String : The message data to be sent.
- s as String (optional): Numeric message code.
- p as boolean (optional): Bit indicating the message should raise an alert.
Returns
o as object: The MessageObject created for this message.
setDeliveryDelay
Sets the delay in milliseconds between publication and delivery.
Syntax
void setDeliveryDelay(
d
)
Parameters
- d as int : Sets the delay in milliseconds.
setReportThreshold
Sets the report threshold for sendMessage.
Syntax
void setReportThreshold(
level
)
Parameters
- level as variant : Int or string value. Int values are 0 - 7, and String values are: ALL, DEBUG, ADVISORY, NORMAL, WARNING, ERROR, FATAL, NONE
sigterm
Termination signal indicating the message service should stop processing messages and subscriptions, and be prepared for destruction.
Syntax
void sigterm(
)
subscribe
Subscribes an object to receive message publications for the specified publication name.
Syntax
void subscribe(
o, e, f, v
)
Parameters
- o as object : The object for which the subscription will belong.
- e as String : The name of the publication.
- f as function : Function to be invoked on message publication.
- v as object : Reference object, such as the publication owner, used to filter publications to this subscription.
unsubscribe
Unsubscribes an object from receiving message publications for the specified publication name.
Syntax
b = unsubscribe(
o, e, f
)
Parameters
- o as object : The object for which the subscription belongs.
- e as String : The name of the publication.
- f as function : Function invoked on message publication.
Returns
b as boolean: Returns true if unsubscribed, false otherwise.