Ejemplo n.º 1
0
        public SubscriptionManager(IServerEvents sse, ICacheClient cache, IFuture future, ISubscriptionStorage storage)
        {
            _sse     = sse;
            _cache   = cache;
            _future  = future;
            _storage = storage;

            _future.FireRepeatedly(TimeSpan.FromSeconds(10), this.Flush, "SSE Flush");
        }
        public StatsMessageHandler(IFuture future, IDemo pulse)
        {
            _future = future;
            _pulse  = pulse;

            if (!_timed)
            {
                _future.FireRepeatedly(TimeSpan.FromSeconds(10), async() =>
                {
                    var commands = Interlocked.Exchange(ref _commands, 0);
                    var events   = Interlocked.Exchange(ref _events, 0);

                    await _pulse.Report("Commands", new { Count = commands }).ConfigureAwait(false);
                    await _pulse.Report("Application", new { Application = "Domain", Events = events, Queries = 0 }).ConfigureAwait(false);
                }, "Demo domain reporter");
                _timed = true;
            }
        }