org.openeai.implementations.services.els.commands
Class EnterpriseSyncErrorLogger

java.lang.Object
  |
  +--org.openeai.OpenEaiObject
        |
        +--org.openeai.jms.consumer.commands.ConsumerCommand
              |
              +--org.openeai.jms.consumer.commands.SyncCommandImpl
                    |
                    +--org.openeai.implementations.services.els.commands.EnterpriseSyncErrorLogger
All Implemented Interfaces:
SyncCommand

public class EnterpriseSyncErrorLogger
extends SyncCommandImpl
implements SyncCommand

The EnterpriseSyncErrorLogger is a part of the OpenEAI "Enterprise Logging Service" (ELS). This particular command consumes messages published to an organization's Enterprise sync error logging topic and stores those messages. Synchronization error messages are published by any sync consuming gateway when errors occur processing those messages. This way, a concise record can be kept of each error that occurs within that gateway. This is of course in addition to any information that gets logged by the gateway at the time of the error.

By deploying a EnterpriseSyncErrorLogger, an organization can keep track of all errors that occur in other Sync consuming gateways and keep a record of them. Then, interfaces can be developed to query those errors in order to determine what errors have occurred etc. and link them back to the actual message that was consumed by the gateway that had the problem. Protocol information (SenderAppId, MessageId etc.) is used to link these messages together.

Version:
#
Author:
Alan Schuele and Greg Hunt

Field Summary
 
Fields inherited from class org.openeai.jms.consumer.commands.ConsumerCommand
CREATE_ACTION, DELETE_ACTION, MESSAGE_ACTION, MESSAGE_CATEGORY, MESSAGE_OBJECT, MESSAGE_RELEASE, MESSAGE_TYPE, QUERY_ACTION, UPDATE_ACTION
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
EnterpriseSyncErrorLogger(CommandConfig cConfig)
          Constructor
 
Method Summary
 void execute(int messageNumber, javax.jms.Message aMessage)
          Inserts the current contents of this object into the database (T_SYNC_ERR_MSG).
 void sendEmail(java.lang.String emailBody)
           
 
Methods inherited from class org.openeai.jms.consumer.commands.SyncCommandImpl
getSyncErrorPublisher, getSyncErrorSyncDoc, getSyncErrorSyncPrimedDocumentUri, publishSyncError, publishSyncError, setSyncErrorSyncDoc, setSyncErrorSyncPrimedDocumentUri
 
Methods inherited from class org.openeai.jms.consumer.commands.ConsumerCommand
addAppConfig, buildError, convertToString, generateRelease, getAppConfig, getAppConfigs, getControlArea, getInboundXmlValidation, getMessageAction, getMessageBody, getMessageCategory, getMessageDumpDirectory, getMessageObject, getMessageRelease, getMessageType, getMsgComponents, getOutboundXmlValidation, initializeInput, setAppConfig, setInboundXmlValidation, setMessageDumpDirectory, setMsgComponents, setOutboundXmlValidation, setWriteToFile, writeMessageToFile, writeToFile
 
Methods inherited from class org.openeai.OpenEaiObject
addLog4jProperty, getAppName, getDebug, getFromAddr, getLog4jProperties, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnterpriseSyncErrorLogger

public EnterpriseSyncErrorLogger(CommandConfig cConfig)
                          throws java.lang.InstantiationException
Constructor

Method Detail

execute

public void execute(int messageNumber,
                    javax.jms.Message aMessage)
             throws CommandException
Inserts the current contents of this object into the database (T_SYNC_ERR_MSG). The object was populated by the calling command (EnterpriseSyncLoggerCommand) and the java.sql.Connection object was retrieved from the Database Connection Pool object associated to this command.

This method not only logs the appropriate ControlArea information into the T_LOGGED_MESSAGE table but it breaks the actual message into segments if the message body is larger than 3900 bytes. This implementation was originally developed for an Oracle database and VARCHAR2 fields can be a maximum of 4000 characters. This is why the message body is broken into segments. Depending on the database implementation being used, this number may be different. The class could also be written to either allow this setting to be configurable or to break the message body into a universal segment that would work for any database. These individual segments are stored in the T_MESSAGE_SEGMENT table.

The ControlArea information (metadata) is inserted into the T_SYNC_ERR_MSG table. The information is pulled from the ControlArea of the message and inserted into the T_SYNC_ERR_MSG table:

ControlArea Element Column Description
ControlAreaSync/Sender/MessageId/SenderAppId CONSUMING_APPL_NAME SenderAppId of the gateway that published the error.
ControlAreaSync/Sender/MessageId/ProducerId CONSUMING_PRODUCER_ID ProducerId associated to the gateway that published the error.
ControlAreaSync/Sender/MessageId/MessageSequence CONSUMING_MSG_SEQ MessageSequence associated to the gateay that published the error.
ControlAreaSync/Result/ProcessedMessageId/SenderAppId PRODUCING_APPL_NAME SenderAppId of the gateway that published the message consumed by the gateway that had the error.
ControlAreaSync/Result/ProcessedMessageId/ProducerId PRODUCING_PRODUCER_ID ProducerId of the gateway that published the message consumed by the gateway that had the error.
ControlAreaSync/Result/ProcessedMessageId/MessageSequence PRODUCING_MSG_SEQ MessageSequence of the gateway that published the message consumed by the gateway that had the error.
ControlAreaSync/Result@action PRODUCING_MSG_ACTION Message action associated to the message that consumed by the gateway that had the error.

The error information associated to the Sync-Error message consumed by this gateway is logged to the T_SYNC_ERROR table. This includes all Errors listed in the Result element of the Sync-Error message. A row will be inserted for each Error listed in the Result element. This information is stored as follows:

ControlArea Element Column Description
ControlAreaSync/Result/Error@type ERROR_TYPE The type of error that occurred in the consuming gateway when it tried to process the message.
ControlAreaSync/Result/Error/ErrorNumber ERROR_NUMBER The error number generated by the gateway that had the error processing the message.
ControlAreaSync/Result/Error/ErrorDescription CONSUMING_APPL_NAME The error description generated by the gateway that had the error processing the message.

Specified by:
execute in interface SyncCommand
Returns:
void

Throws:
CommandException - if errors occur initializing the command with the message passed in. This particular command may throw this exception when it has errors turning the text associated to the Message into a JDOM Document or if it has problems persisting the contents. This is because it would be redundant for this consumer to publish CoreMessaging/Sync/Error-Sync messages to itself. Instead of publishing the Sync/Error-Sync message, this command may either throw an exception or write the message to the file system if it has problems persisting the message.
See Also:
RequestMessage.execute

sendEmail

public void sendEmail(java.lang.String emailBody)


Copyright © 2002, OpenEAI Software Foundation