                                        README

                                    ErrorQueueCleanup
                                      Version 1.0

Introduction:
ErrorQueueCleanup is a stand-alone java application that reads messages from ErrorQueue and processes the messages as follows:
1. Duplicate clinical messages are removed from the ErrorQueue.
2. Non-duplicate clinical messages are sent across to CDS Message Mediator for further processing
3. Non-clinical messages are retained on the ErrorQueue
The application allows users to specify the duration for which the process should run thus enabling users to clean up the messages from ErrrorQueue in stages.
If the duration is not specified, the application will run for a duration of 1 hour unless an ErrorQueueShutdown is issued prior to the completion of the hour.

ErrorQueueShutdown is yet another stand-alone java application that can be used to shut down the ErrorQCleanUp processing before the specified durtaion has expired.


Packaging:
The ErrorQueueCleanup and ErrorQueueShutdown applications are packaged together into a single zip file.
The contents of the zip file are as follows:
- errorq-cleanup/readme.txt � this readme.txt file
- errorq-cleanup/errorqcleanup.<xxx>.properties � Sample property file that shows the various properties that have to be set up in order for the application to connect to the appropriate Weblogic server, database, NDS server [NOTE: users should either modify or create a new properties file that will allow them to connect to the appropriate Weblogic server, database, NDS server and use the modified/newly created property file in the .sh or .bat for correct execution of the application]
- errorq-cleanup/errorqcleanup.caip.config.xml - caip config file has the connection details of NDS server like SiteName, Application and NDSConnections properties. [NOTE: modify the appropriate NDS SiteName, Application and NDSConnections properties]
- errorq-cleanup/log4j.xml � Log4j configuration file � defines a rolling file appender and a standard output appender. [NOTE: You may edit this file to modify the logging configuration]
- errorq-cleanup/errorqcleanup.java.policy - this is a Java policy file.
- errorq-cleanup/bin/startErrorQCleanup.bat � Batch file that should be modified and used to kick off the ErrorQueueCleanup process in a Windows environment (shows all the configuration options that have to be set up in order to execute the application) [NOTE: modify the file to specify the correct property file to use, the duration in minutes for how long the errorQClenup process need to be executed, JMX details, and the errorq library/jar file]
- errorq-cleanup/bin/startErrorQCleanup.sh � Shell script that should be modified and used to kick off the ErrorQueueCleanup process in a Linux/Unix environment (shows all the configuration options that have to be set up in order to execute the application) [NOTE: modify the file to specify the correct property file to use, the duration in minutes for how long the errorQClenup process need to be executed, JMX details, and the errorq library/jar file]
- errorq-cleanup/bin/stopErrorQCleanup.bat � Batch file that can be modified and used to stop the ErrorQueueCleanup process in a Windows environment [NOTE: modify the file to specify the correct errorq library/jar file to use and JMX details]
- errorq-cleanup/bin/stopErrorQCleanup.sh � Shell script that can be modified and used to stop the ErrorQueueCleanup process in a Linux/Unix environment [NOTE: modify the file to specify the correct errorq library/jar file to use and JMX details]
- errorq-cleanup/lib/*.jar � application and dependent jar files

Installation:
Unzip the errorq-cleanup-<version>.zip into a directory of your choice. The application has the directory structure as follows:
errorq-cleanup
errorq-cleanup/bin
errorq-cleanup/lib

Make sure that the files specified in the packaging section exist.


Execution Instructions:
1. First read the encryptionReadme.txt file.
2. Change to the errorq-cleanup directory (cd errorq-cleanup). Edit / Create a new properties/caip config file along the lines of the sample properties file and ensure that the appropriate database information is specified in the edited / new properties file
3. Change to the errorq-cleanup/bin directory (cd ../bin). Make sure that the cds.run.properties.path in the startErrorQCleanup.bat or startErrorQCleanup.sh file is pointing to the edited or newly created properties file
4. On Unix/Linux shell, execute the startErrorQCleanup.sh as follows: sh ./startErrorQCleanup.sh [If in windows, execute the startErrorQCleanup.bat]



Fixes
-----

v1.0.14	SJB	10/27/10	now error q cleanup won't reprocess exceptions that create failures storing to audit_clob_str, and treats other runtime exceptions as error queue exceptions.
v1.0.15	SJB	11/10/10	Now processes lab messages with empty obx2 and "" in obx5.
v1.0.16	SJB	11/18/10	DOA fix via configuration change to table names.
v1.0.17	SJB	11/24/10	New ability to reprocess all messages.  Does not perform duplicate check on Lab messages due to bug in getting correct record identifier for Lab.
v1.0.18	SJB	01/13/11	Added database logging for cleanup process.  Also bug fix for invalid Sending Application.
v1.0.19	SJB	01/21/11	Tried to resolve logging threading issue. Now handles messages with sending facility id and no facility name in MSH 4.2.
v1.0.20	SJB	02/10/11	Resolved issue with race conditions at database.  Now logs facility information.
v1.0.21	SJB	02/23/11	Enhanced logging for PSIM graph messages to show ids and correlation requests.
v1.0.22 SJB	03/31/11	1) Fix for better one-time processing of all messages in error queue.  Now pass in a value on command line for processing all messages.  Also now does all messages, not just previously processed ones. 2) Now records message when it can't be parsed so we can investigate later. 3) Ignores PING messages.
