Message Processing
BusinessEvents uses StreamBaseSerializer to processes the incoming and outgoing messages in StreamBase channel.
Incoming Messages
StreamBaseSerializer takes the incoming message from the StreamBase server, which is cast as a Tuple. The Tuple is transformed to the corresponding BusinessEvents event. The BusinessEvents event is then asserted into working memory.
- The schema is retrieved from the Tuple
- All fields are then retrieved from the schema
- For each field from the Tuple, the event is checked for a matching property (field name).
- If a matching property is found, the property value is set to the field value from the Tuple.
- If no matching property is found, a warning is logged and the process moves to the next field.
Outgoing Messages
The two functions in BusinessEvents that you can use to send events out to other application are:
For the StreamBase channel, use these functions to send a tuple back to StreamBase. Using StreamBaseSerializer these functions transform the event into a tuple, and enqueue the tuple to the stream specified in the destination.
Datatype Conversion
Some of the BusinessEvents simple event property types are directly mapped to the datatype of the StreamBase tuple fields. The StreamBase datatypes that cannot be directly mapped to the BusinessEvents property type are converted to String representation.
The following table lists the StreamBase datatypes and their respective BusinessEvents datatypes (if present).
StreamBase Datatype | BusinessEvents Datatype |
---|---|
DataType.BOOL | boolean |
DataType.DOUBLE | double |
DataType.INT | int |
DataType.LONG | long |
DataType.STRING | String |
DataType.TIMESTAMP | DateTime |
DataType.BLOB | String |
DataType.LIST | String |
DataType.TUPLE | JSON
String
Tuple value is converted to JSON string, which can be used later on. For example, you can use JSON function to extract object values. |
DataType.FUNCTION | String
Note: The Function type is available only when client type is dequeuer. It holds value as string representation of the function definition which can be used for testing or debugging purposes. |