public static void TestBrokerUpdates() { List <Application> applications = ApplicationDAO.Get(); applications.ForEach(delegate(Application application) { if (application.name != "RSERVER") { return; } List <MessageBucket> brokerInformation = MessageBucketDAO.GetUnprocessedMessageHeaderInstancesByApplication(application); //List<Broker> brokerInformation //= BrokerDAO.GetProcessedMessageHeaderInstancesByApplication(application); brokerInformation.ForEach(delegate(MessageBucket broker) { // get the message header and message MessageHeaderInstance messageHeaderInstance = broker.messageHeaderInstance; Message message = broker.message; // update the table to processed MessageBucketDAO.UpdateProcessedFlagAndMessageLog(messageHeaderInstance, message, true); //BrokerDAO.ReprocessMessage(messageHeaderInstance.messageControlId); }); }); }
public static void handleProcessingForOutboundHandler(Configuration masterConfig, OutboundHandler outboundHandler) { // to control some basic CPU handling settings Config outboundConfig = new Config(); // load each of the configurations into their own objects List <Application> applications = masterConfig.applications; List <Communication> communications = masterConfig.communications; List <WebserviceObject> webserviceObjects = masterConfig.webserviceObjects; List <WebserviceInstance> webserviceInstances = masterConfig.webserviceInstances; List <WebservicePropertySet> webserviceProperties = masterConfig.webservicePropertySets; List <MessageGroup> messageGroups = masterConfig.messageGroups; List <MessageGroupInstance> messageGroupInstances = masterConfig.messageGroupInstances; // continue to read the table while (true) { applications.ForEach(delegate(Application app) { if (app.name == outboundHandler.getApplicationName()) { // get the unprocessed message count for the application List <MessageBucket> brokerInformation = MessageBucketDAO.GetUnprocessedMessageHeaderInstancesByApplication(app); // set the MOD from config file. var options = new ParallelOptions { MaxDegreeOfParallelism = outboundConfig.MaxDegreeOfParallelism }; // parallel For each Parallel.ForEach(brokerInformation, options, broker => { // get the message header and message MessageHeaderInstance messageHeaderInstance = broker.messageHeaderInstance; Message message = broker.message; // srub the input of bad stuff string hl7Scrubbed = HL7MessageUtility.scrubHL7MessageForParse(message.hl7Raw); // make the hl7 message HL7Message hl7Message = HL7MessageDAO.getMessage(hl7Scrubbed); // locally retrieve the communication object from memory Communication communication = ConfigurationUtility.GetIncomingWebserviceCommunication(app, communications); // locally retrieve the webservice instance object from memory WebserviceInstance webserviceInstance = ConfigurationUtility.GetIncomingWebserviceInstance(communication, webserviceInstances); // locally retrieve the web service objects from memory List <WebserviceObject> wsObjects = ConfigurationUtility.GetIncomingWebserviceObjects(webserviceInstance, webserviceObjects); // determine the message type Generic.MessageType messageType = HL7MessageUtility.getMessageType(hl7Message, hl7Scrubbed); switch (messageType) { // to handle a new message add message type then its own handler case Generic.MessageType.ADT: break; case Generic.MessageType.ORM: handleProcessingForORM(wsObjects, webserviceProperties, hl7Message, messageGroupInstances, messageGroups, app, message); break; case Generic.MessageType.ORU: handleProcessingForORU(wsObjects, webserviceProperties, hl7Message, messageGroupInstances, messageGroups, app, message); break; case Generic.MessageType.SIU: break; case Generic.MessageType.UNKNOWN: break; default: break; } // update the table to processed MessageBucketDAO.UpdateProcessedFlagAndMessageLog(messageHeaderInstance, message, true); // update broker stats handleBrokerStatUpdate(message, communication); }); } }); // provide blocking if there is no data to process. Thread.Sleep(1000); } }
public static void TestConfigLoad() { Configuration masterConfig = ConfigurationDAO.GetAllConfigurations(); List <Application> applications = masterConfig.applications; List <Communication> communications = masterConfig.communications; List <WebserviceObject> webserviceObjects = masterConfig.webserviceObjects; List <WebserviceInstance> webserviceInstances = masterConfig.webserviceInstances; List <WebservicePropertySet> webserviceProperties = masterConfig.webservicePropertySets; List <MessageGroup> messageGroups = masterConfig.messageGroups; applications.ForEach(delegate(Application app) { if (app.name != RSERVER) { return; } // get the unprocessed message count for the application List <MessageBucket> brokerInformation = MessageBucketDAO.GetUnprocessedMessageHeaderInstancesByApplication(app); brokerInformation.ForEach(delegate(MessageBucket broker) { // get the message header and message MessageHeaderInstance messageHeaderInstance = broker.messageHeaderInstance; Message message = broker.message; // locally retrieve the communication object from memory Communication communication = ConfigurationUtility.GetIncomingWebserviceCommunication(app, communications); // locally retrieve the webservice instance object from memory WebserviceInstance webserviceInstance = ConfigurationUtility.GetIncomingWebserviceInstance(communication, webserviceInstances); // locally retrieve the web service objects from memory List <WebserviceObject> wsObjects = ConfigurationUtility.GetIncomingWebserviceObjects(webserviceInstance, webserviceObjects); // for each object - for each property set for that object - handle accordingly wsObjects.ForEach(delegate(WebserviceObject wsObject) { Console.WriteLine("OBJECT:" + wsObject.name); List <WebservicePropertySet> wsProperties = ConfigurationUtility.GetIncomingWebservicePropertySets(wsObject, webserviceProperties); wsProperties.ForEach(delegate(WebservicePropertySet wsProperty) { Console.WriteLine("Property:" + wsProperty.name); List <MessageGroup> msGroups = ConfigurationUtility.GetIncomingWebserviceMessageGroup(wsProperty, messageGroups); Console.WriteLine("Group Count:" + msGroups.Count); }); }); // update the table to processed // BrokerDAO.UpdateProcessedFlagAndMessageLog(messageHeaderInstance, message, true); }); }); }