Пример #1
0
        void NewTransaction(object sender, KJFramework.EventArgs.LightSingleArgEventArgs <IMessageTransaction <MetadataContainer> > e)
        {
            NewProcessorObject         obj;
            MetadataMessageTransaction transaction = (MetadataMessageTransaction)e.Target;

            if (!transaction.Request.IsAttibuteExsits(0x00))
            {
                throw new KeyHasNullException();
            }
            MessageIdentity identity = transaction.Request.GetAttribute(0x00).GetValue <MessageIdentity>();

            lock (_processorLockObj)
            {
                if (!_processors.TryGetValue(new Protocols {
                    ProtocolId = identity.ProtocolId, ServiceId = identity.ServiceId, DetailsId = identity.DetailsId
                }, out obj))
                {
                    _tracing.Error("#Schedule message failed, because cannot find processor. #P:{0}, S{1}, D{2}", identity.ProtocolId, identity.ServiceId, identity.DetailsId);
                    return;
                }
            }
            try
            {
                obj.Processor.Process(transaction);
            }
            catch (System.Exception ex) { _tracing.Error(ex, null); }
        }
Пример #2
0
        void NewTransaction(object sender, KJFramework.EventArgs.LightSingleArgEventArgs <IMessageTransaction <BaseMessage> > e)
        {
            BusinessMessageTransaction transaction = (BusinessMessageTransaction)e.Target;
            IMessageProcessor          processor;
            MessageIdentity            identity = transaction.Request.MessageIdentity;

            if (!_processors.TryGetValue(new Protocols {
                ProtocolId = identity.ProtocolId, ServiceId = identity.ServiceId, DetailsId = identity.DetailsId
            }, out processor))
            {
                _tracing.Error("#Schedule message failed, because cannot find processor. #P:{0}, S{1}, D{2}", identity.ProtocolId, identity.ServiceId, identity.DetailsId);
                return;
            }
            try { processor.Process(transaction); }
            catch (Exception ex) { _tracing.Error(ex, null); }
        }