Record Reader

Executive Summary

RecordReader is a standalone java application, intend to resides on Amazon EC2 and use Webservices provided by Amazon.  The application starts by reading a configuration properties file and parsing it to find user provided values for application properties. The properties include log4j settings, MySQL credentials, Amazon SQS credentials etc. If the credentials are validated, it then creates two threads to do the main job.

Application does its job in a loop. It first fetches a string message in XML format from Amazon SimpleQueueService, then parses the XML message using XOM library to get its contents to create a Record entity which presents one record entry of a car repairing shop.  A Record entity have some properties and Item entities again each Item entity have some properties and SubItem entities and each SubItem have some property.  After creating a Record, the application then persists the Record’s content along with the contents of all its Items and SubItems to Mysql database mounted on Amazon RDS. Any errors if arising during this process will be persisted to database along with the record number and also written to log file. Also, each important step of the application is logged to a log file, which is created in a daily basis. After persisting one record or any exception the application deletes the retrieved message from the SQS Queue and continues with fetching another message from Queue. If no message is available in the Queue, it sleeps for some minutes provided by the user in config file as application sleep time.

From the two threads created by the application, one does the above task, while other waits for shut down command given over Socket connection. On receiving a shutdown command, it initiates a shutdown process by interrupting the above executing thread, which then does some housekeeping job and leaves the loop to end the application.

About our Client

IT Company

Industry

IT

Technologies

Java