Use the Message Logger mediation primitive to store messages in a database.
The Message Logger mediation primitive stores messages in a database, during a mediation flow. The Message Logger mediation primitive logs messages to a relational database using an IBM-defined database schema, it does not write to other storage mediums such as flat files.
The Message Logger mediation primitive logs an XML transcoded copy of the SMO. The default behavior is to log just the payload but the mediation primitive can be configured to log the complete SMO, or a part of the SMO defined by an XPath expression. Along with the message contents the mediation primitive also logs a timestamp, the message identifier, the primitive instance name, the mediation module instance name and the SMO version number.
The message that is logged is stored in a database column called: Message. The other data that is logged is stored in columns with an appropriate heading, as documented later in this topic.
The Message Logger mediation primitive has one input terminal and two output terminals. One output terminal is for successful output and one for failure output. The input terminal is wired to accept a message and the output terminals are wired to propagate a message. The input message triggers logging to a database and if the logging is successful then the successful output terminal propagates the original message. If an exception occurs during the processing of the input message, then the fail terminal propagates the original message, together with any exception information.
You can use the Message Logger mediation primitive to store messages that you process later. The logged messages can be used for various purposes. For example, you could use the logged messages for data mining or for auditing.
Logging the data as XML means that it can be processed by any XML-aware application. Many databases, including DB2, provide built-in capabilities to handle XML contained in a database column.
The default installation of the runtime product creates a standalone application server, and a Cloudscape database and datasource. The Message Logger mediation primitive is configured to use this Cloudscape database, by default. During a custom install of the runtime product you can choose whether to create a Cloudscape database and datasource. The runtime product also provides a script, called createMessageLoggerResource.jacl, that creates a Cloudscape database.
Property | Valid Values | Default |
---|---|---|
Data source name | String | jdbc/mediation/messageLog |
Root | String: an XPath expression representing the root of the transformation | /body |
Transaction mode | String: Same or New | Same |
Column Name | SQL Type | Key Field | Description |
---|---|---|---|
TimeStamp | TIMESTAMP | Y | The UTC timestamp, indicating when the message was logged to the database. |
MessageID | VARCHAR | Y | The message ID, from the SMO. |
MediationName | VARCHAR | N | The name of the mediation primitive instance that logged the message. |
ModuleName | VARCHAR | N | The name of the mediation module instance that contains the Message Logger primitive. |
Message | CLOB | N | The SMO, transcoded into XML. |
Version | VARCHAR | N | The version of the logged SMO. |
Consider the following when using the Message Logger mediation primitive: