Пример #1
0
        public void Start(Envelope envelope, string activity)
        {
            var track = new MessageTrack(envelope.CorrelationId, activity);

            lock (_lock)
            {
                if (_outstanding.ContainsKey(track.Key))
                {
                    _outstanding[track.Key] = track;
                }
                else
                {
                    _outstanding.Add(track.Key, track);
                }
            }
        }
Пример #2
0
        public void Complete(Envelope envelope, string activity, Exception ex = null)
        {
            var key = MessageTrack.ToKey(envelope.CorrelationId, activity);

            lock (_lock)
            {
                if (_outstanding.ContainsKey(key))
                {
                    var track = _outstanding[key];
                    _outstanding.Remove(key);

                    track.Finish(envelope, ex);

                    _completed.Add(track);

                    processCompletion();
                }
            }
        }