Universal Messaging Event Attributes
Universal Messaging Event Attributes are objects which contain meta-data about a Universal Messaging Event. A Client can query the attributes of a delivered event to provide specific handling for different types of event depending on its attributes.
Some header information contained in an Event Attributes object can be set by the client prior to publishing the Event. This information will subsequently be delivered to any clients who receive it.
Obtaining an nEventAttributes object
If an Event does not explicitly have any Event Attributes, then a new,
empty Event Attributes object is initialized for the Event with a call to
getEventAttributes()
:
var attribs = someEvent.getEventAttributes();
attribs.setPublisherName("John Doe");
myChannel.publish(someEvent);
For more detailed usage information, please see the JavaScript API Documentation for Event Attributes.
Merging and Registered Events
Registered
Events facilitate delivery of partial events containing only the data
which has changed to a client. A publisher can publish and subsequently update
a registered event through JavaScript by using the
setAllowMerge
method of nEventAttributes.
myEvent.putDictionary(aDictionary);
myEvent.getEventAttributes().setAllowMerge(true);
myChannel.publish(someEvent);
A JavaScript client can query if a received event is a registered
event by checking the
isRegistered
flag on the nEventAttributes object
if(aEvent.getAttributes().isRegistered()) {
// Some registered event specific code here...
}
Similarly, a JavaScript client which receives an event can query if it
is a full or partial event by checking if the
isDelta
flag is set on an nEventAttributes object.
if(aEvent.getAttributes().isDelta()) {
// Some registered delta-specific code here...
}
Obtaining the Event TimeStamp
If configured to do so, the realm server will stamp each event it delivers to the client with the time it was received. This timestamp can be accessed through the nEventAttributes object.
var age = now - aEvent.getAttributes().getTimeStamp();
Other Headers
The nEventAttributes object also contains methods for setting and getting other attributes associated with the object. These include JMS specific headers and details on the origin, destination and join channels. To see the full list of operations available on this object consult the API documentation.