Example #1
0
        public IncomingEntry ReceiveMessage(ComplianceMessage message, out bool shouldProcess)
        {
            shouldProcess = true;
            message.ProtocolContext.Direction = ProtocolContext.MessageDirection.Incoming;
            IncomingEntry incomingEntry = this.GetIncomingEntry(message, false);

            if (incomingEntry != null)
            {
                if (incomingEntry.Status == IncomingEntry.IncomingEntryStatus.Processed)
                {
                    shouldProcess = false;
                }
                else if (incomingEntry.Status == IncomingEntry.IncomingEntryStatus.Completed)
                {
                    shouldProcess = false;
                    incomingEntry.RequestReissued();
                }
            }
            OutgoingEntry outgoingEntry = incomingEntry.ReturnOutgoingEntry(message);

            if (outgoingEntry != null && outgoingEntry.Status != OutgoingEntry.OutgoingEntryStatus.Completed)
            {
                message.ProtocolContext.Direction = ProtocolContext.MessageDirection.Return;
                if (!shouldProcess)
                {
                    shouldProcess = true;
                }
            }
            return(incomingEntry);
        }
Example #2
0
 public OutgoingEntry ReturnOutgoingEntry(ComplianceMessage message)
 {
     if (message.ComplianceMessageType == ComplianceMessageType.RecordResult)
     {
         OutgoingEntry outgoingEntry = this.AddOutgoingEntry(message);
         if (outgoingEntry != null)
         {
             outgoingEntry.Status = OutgoingEntry.OutgoingEntryStatus.Returned;
             return(outgoingEntry);
         }
     }
     return(null);
 }
Example #3
0
        public OutgoingEntry AddOutgoingEntry(ComplianceMessage message)
        {
            OutgoingEntry outgoingEntry = this.GetOutgoingEntry(message, false);

            if (outgoingEntry != null && outgoingEntry.Status != OutgoingEntry.OutgoingEntryStatus.Completed)
            {
                int value = 0;
                if (this.outgoingKeys.TryAdd(outgoingEntry.GetKey(), value))
                {
                    outgoingEntry.EvaluateState(false);
                }
            }
            return(outgoingEntry);
        }
Example #4
0
        public void CompleteOutgoingEntry(ComplianceMessage message)
        {
            OutgoingEntry outgoingEntry = this.GetOutgoingEntry(message, true);

            if (outgoingEntry != null)
            {
                int num;
                this.outgoingKeys.TryRemove(outgoingEntry.GetKey(), out num);
                outgoingEntry.Status = OutgoingEntry.OutgoingEntryStatus.Completed;
            }
            if (this.outgoingKeys.Count == 0 && this.Status == IncomingEntry.IncomingEntryStatus.Processed)
            {
                this.Status = IncomingEntry.IncomingEntryStatus.Returned;
            }
        }
Example #5
0
        public void DispatchedMessage(ComplianceMessage message)
        {
            IncomingEntry incomingEntry = message.ProtocolContext.DispatchData as IncomingEntry;

            if (incomingEntry != null)
            {
                incomingEntry.Status = IncomingEntry.IncomingEntryStatus.Completed;
                return;
            }
            OutgoingEntry outgoingEntry = message.ProtocolContext.DispatchData as OutgoingEntry;

            if (outgoingEntry != null)
            {
                outgoingEntry.Status = OutgoingEntry.OutgoingEntryStatus.Delivered;
            }
        }
Example #6
0
        public OutgoingEntry GetOutgoingEntry(ComplianceMessage message, bool onlyIfExists = false)
        {
            OutgoingEntry outgoingEntry = new OutgoingEntry(message);

            if (!onlyIfExists)
            {
                return(outgoingEntry.UpdateCache(RoutingCache.Instance.RoutingTable) as OutgoingEntry);
            }
            CacheItem cacheItem = RoutingCache.Instance.RoutingTable.GetCacheItem(outgoingEntry.GetKey(), null);

            if (cacheItem != null)
            {
                return(cacheItem.Value as OutgoingEntry);
            }
            return(null);
        }