示例#1
0
        void EnqueueResponse(Guid awaitID, Message orig, Message response)
        {
            lock (_LocalWaiting)
            {
                if (_LocalWaiting.ContainsKey(orig.MessageID))
                {
                    _LocalWaiting[orig.MessageID] = response;
                    orig.onResponse -= Waiting_onResponse;

                    while (true)
                    {
                        try
                        {
                            if (!_AwaitResponse.ContainsKey(awaitID))
                            {
                                return;
                            }

                            break;
                        }
                        catch { }
                    }
                }
            }

            if (_ResponseReceivedQueue != null)
            {
                _ResponseReceivedQueue.EnqueueObject(new object[] { orig, response });
            }
        }
        public override void Receive(string message, DateTime received)
        {
            try
            {
                if (message.Contains("STEM.Sys.Messaging.ConnectionTest"))
                {
                    return;
                }

                if (_QueueReceivedData && _MessageReceivedQueue != null)
                {
                    _MessageReceivedQueue.EnqueueObject(new object[] { message, received });
                }
                else
                {
                    ProcessMessageReceived(message, received);
                }
            }
            catch (Exception ex)
            {
                STEM.Sys.EventLog.WriteEntry(System.Reflection.Assembly.GetEntryAssembly().GetName().Name + ".MessageConnection.Receive", RemoteAddress + ":" + RemotePort + " \r\n" + ex.ToString(), STEM.Sys.EventLog.EventLogEntryType.Error);
            }
        }