Filed under: Best Practices, Featured
  Comments: None

A message (Transfer Object) contains a unit of information with a message as its root and a hierarchy of messages, collections of messages, or primitive values (where primitive values are defined by a pair consisting of a named attribute with a value for the primitive). This message can be passed to another function or system.

For example, a message can be used to transfer information from a source database to a destination database on a completely different platform. Also, you can use a message to send heterogeneous information to functions that may need to handle varied input or messages.

Messages support operations to set and get values in the message, test if a message contains a value, an operation to remove values or sub-messages, and an iterator of sub-messages.

Message example

Using a message to create a new instance

The following is an example of message passed to the ‘new function which will create a new instance based on the attributes defined in the message. This message creates a progressed opportunity with a specific template, user, and parent opportunity.

Using a message to send heterogeneous information and then iterate through the sub-messages

This is an example of a message with a collection of heterogeneous messages to create filter rule subject areas. The message defines the subject areas to create with their supplied attributes. An iterator is used to read each subject area message and then build a new instance accessing the messages attributes similar to the previous example.

Using a message to transfer a table from one database to another

The databases can be different versions of the same type, or two different types of databases, for example Oracle and DB2.

Essentially, two functions are required.

post6

The first function generates a message based on the rows of the table in the original database.

The second function is used to perform any transformations needed by the receiving database. In this example, the first database does not require an age but the second database does. We will make a transformation function to read a row message and, if there is no age, set the value to a default value of -1 to meet the requirement.

 

Be the first to write a comment.

Your feedback

You must be logged in to post a comment.