Esempio n. 1
0
        private void ProcessMessage(string messageResponse)
        {
            var response = new VerimatrixResponse(messageResponse);

            try
            {
                if (!IsRegistered)
                {
                    if (response.Status == Enums.Status.Register)
                    {
                        this.IsRegistered = true;
                        this.registerWaitHandler.Set();
                    }
                    // registation failed
                    else
                    {
                        this.registerWaitHandler.Set();
                    }
                }
                else
                {
                    //Logger.Info(string.Format("Message received: {0}", messageResponse));

                    var logEntity = VerimatrixMessageDataAccess.GetRequestData(messageResponse);
                    IReceiveLogHandler logHandler = new VerimatrixLogHandler(this.ComponentCtx, response, logEntity);

                    // hold command doesn't has response
                    if (HoldtlTimer != null)
                    {
                        HoldtlTimer.Change(this.tcpSenderParameter.HoldCommandIntervalms,
                                           this.tcpSenderParameter.HoldCommandIntervalms);
                    }

                    if (response.Status == Enums.Status.Success || response.Status == Enums.Status.Error)
                    {
                        this.LogReceiveMessage(logHandler.GetReceiveLog(), this.GetAsyncLogDictionary(logEntity));
                    }

                    if (response.Status == Enums.Status.Shutdown)
                    {
                        this.IsShutdown = true;
                    }
                }
            }
            catch (Exception ex)
            {
                var log = new Log()
                {
                    MessageText       = ex.Message,
                    MessageQualifier  = (int)CommunicationLogEntryMessageQualifier.Error,
                    Host              = this.HostName,
                    MessageTrackingId = this.CommandName
                };
                ComponentCtx.WriteInfo(log);
            }
        }
Esempio n. 2
0
 public VerimatrixLogHandler(IComponentContext context, VerimatrixResponse response, VerimatrixLogEntity entity)
 {
     this._response         = response;
     this._componentContext = context;
     this._entity           = entity;
 }