Nirvana J2ME : Event Dictionaries

Event Dictionaries provide an accessible and flexible way to store any number of message properties for delivery within a Nirvana Event. Event Dictionaries can be used to expose metadata attributes of the body or to represent a structured message that can be consumed and read without any additional parsing.

Nirvana filtering allows subscribers to receive only specific subsets of a channel's events by applying the server's advanced filtering capabilities to the contents of each event's dictionary.

In this code snippet, we publish different primitive types:

nEventProperties myProps=new nEventProperties();
String stringValue="Hello World";
int iValue=1;
long lValue=1;
J2MEFloat fValue=new J2MEFloat("1.1");
J2MEDouble dValue=new J2MEDouble("1.1");

myProps.put("stringKey", stringValue);
myProps.put("intKey",iValue);
myProps.put("longKey", lValue);
myProps.put("floatKey", fValue);
myProps.put("doubleKey", dValue);

nObject evt=nObject.createConsumeEvent(myProps,"".getBytes());

Note that in this example code, we also create a new Nirvana Event object (nObject) to make use of our Event Dictionary.

Also note that due to the absense of native floating point primitive types in J2ME we provide implementation objects called J2MEDouble and J2MEFloat to represent double and float types respectively.