Exemplo n.º 1
0
        Task RecordEndpointInstanceId(IMessageHandlerContext context)
        {
            var instanceId = EndpointInstanceId.From(context.MessageHeaders);

            endpointRegistry.Record(instanceId);
            activityTracker.Record(instanceId, DateTime.UtcNow);

            return(TaskEx.Completed);
        }
        public bool IsStale(EndpointInstanceId endpointInstance)
        {
            if (endpointsInstances.TryGetValue(endpointInstance, out var lastActivityTime))
            {
                var age = DateTime.UtcNow - lastActivityTime;
                return(age > StalenessThreshold);
            }

            return(true);
        }
Exemplo n.º 3
0
        public bool IsStale(EndpointInstanceId endpointInstance)
        {
            DateTime lastActivityTime;

            if (endpointsInstances.TryGetValue(endpointInstance, out lastActivityTime))
            {
                var timeSpan = DateTime.UtcNow - lastActivityTime;
                return(timeSpan > StalenessThreshold);
            }

            return(false);
        }
 public void Remove(EndpointInstanceId instanceId)
 {
     endpointsInstances.TryRemove(instanceId, out _);
 }
 public void Record(EndpointInstanceId instanceId, DateTime utcNow)
 {
     endpointsInstances.AddOrUpdate(instanceId, utcNow, (_, __) => utcNow);
 }
Exemplo n.º 6
0
 protected bool Equals(EndpointInstanceId other)
 {
     return(string.Equals(EndpointName, other.EndpointName) &&
            string.Equals(InstanceId, other.InstanceId));
 }