Ejemplo n.º 1
0
        public void ReceiveMessage(IPushRoute route, Message message)
        {
            if (message != null &&
                message.Header != null) // &&
            //MessageRegistry.RHISPIX_NotificationMessageType.EqualsTo(message.Header.Type))    // do not need validation so strict
            {
                string id = message.Header.ID.ToString();
                _context.Log.Write(string.Format("Begin processing subscribed message. Message ID: {0}", id));

                SOAPClientControlerProcessStatus s = _controler.ProcessSubscribedMessage(message);

                _context.Log.Write(string.Format("End processing subscribed message. Message ID: {0}. Result: {1}", id, s));
                _context.Log.Write("");

                //SendLogMessage(string.Format("Receive SOAP response {0}",s),message.Body.ToString(),"null");
                if (s == SOAPClientControlerProcessStatus.SendingSOAPMessageError)
                {
                    LPCException.RaiseLPCException(route, "Sending SOAP message error, maybe retry is needed.");
                }

                if (s == SOAPClientControlerProcessStatus.RecevingFailureSOAPResponse)
                {
                    LPCException.RaiseLPCException(route, "Sending SOAP message success, and recieve a failure response.");
                }
            }
            else
            {
                _context.Log.Write(LogType.Error, "Received publishing message failed or receive a unwanted publishing message.");
            }
        }
Ejemplo n.º 2
0
        public void ReceiveMessage(IPushRoute route, Message message)
        {
            bool sndResult = false;

            try
            {
                if (message != null &&
                    message.Header != null)
                {
                    string desc = string.Format("processing message type: {0} id: {1} in thread id: {2}",
                                                message.Header.Type, message.Header.ID.ToString(), System.Threading.Thread.CurrentThread.ManagedThreadId);

                    Program.Log.Write(string.Format("Subscriber begin {0}", desc));
                    sndResult = _controler.DispatchSubscriberMessage(message);
                    Program.Log.Write(string.Format("Subscriber finish {0}. Result: {1}", desc, sndResult));
                    Program.Log.Write("");
                }
                else
                {
                    Program.Log.Write(LogType.Error, "Received publishing message failed or receive a unwanted publishing message.");
                }
            }
            catch (Exception err)
            {
                Program.Log.Write(err);
            }

            if (!sndResult)
            {
                LPCException.RaiseLPCException(route, "Dispatching and processing message success but sending message failed, maybe retry is needed.");
            }
        }
Ejemplo n.º 3
0
        public void ReceiveMessage(IPushRoute route, Message message)
        {
            bool sndResult = false;

            try
            {
                if (message != null &&
                    message.Header != null)
                {
                    switch (_context.ConfigMgr.Config.MessageProcessingType)
                    {
                    case MessageProcessType.HL7v2Text:
                        string payload = HL7MessageHelper.GetHL7V2PayLoad(message);
                        sndResult = _controler.SendMLLPNotification(payload);
                        break;

                    case MessageProcessType.HL7v2XML:
                        string hl7xml = message.Body;
                        sndResult = _controler.SendHL7v2XMLNotification(hl7xml);
                        break;

                    default:
                    case MessageProcessType.OtherXML:
                        sndResult = _controler.SendOtherXMLNotification(message);
                        break;
                    }

                    ////if (MessageRegistry.HL7V2_NotificationMessageType.EqualsTo(message.Header.Type))
                    //if (!_context.Context.ConfigMgr.Config.EnableHL7XMLTransform)
                    //{
                    //    string payload = HL7MessageHelper.GetHL7V2PayLoad(message);
                    //    sndResult = _controler.SendNotification(payload);
                    //}
                    ////else if (MessageRegistry.HL7V2XML_NotificationMessageType.EqualsTo(message.Header.Type))
                    //else
                    //{
                    //    string hl7xml = message.Body;
                    //    sndResult = _controler.SendXMLNotification(hl7xml);
                    //}
                    ////else
                    ////{
                    ////    _context.Log.Write(LogType.Error, "Received a unwanted publishing message.");
                    ////}
                }
                else
                {
                    _context.Log.Write(LogType.Error, "Received publishing message failed.");
                }
            }
            catch (Exception e)
            {
                _context.Log.Write(e);
            }

            if (!sndResult)
            {
                LPCException.RaiseLPCException(route, "Send HL7 message failed, maybe retry is needed.");
            }
        }
Ejemplo n.º 4
0
        public void ReceiveMessage(IPushRoute route, Message message)
        {
            if (message != null && message.Header != null)
            {
                string id = message.Header.ID.ToString();
                _context.Log.Write(string.Format("Begin processing subscribed message. Message ID: {0}", id));

                bool res = _controler.ProcessSubscribedMessage(message);
                _context.Log.Write(string.Format("End processing subscribed message. Message ID: {0}. Result: {1}", id, res));
                _context.Log.Write("");

                if (!res)
                {
                    LPCException.RaiseLPCException(route, "File Writer process error.maybe need republish it.");
                }
            }
            else
            {
                _context.Log.Write(LogType.Error, "Received publishing message failed or receive a unwanted publishing message.");
            }
        }