コード例 #1
0
        private void OnStreamDisconnected(object sender, StreamListenerEventArgs e)
        {
            var listener = e.Listener;
            var shouldFastTrackReconnect = !listener.IsFixtureDeleted && listener.IsDisconnected && e.MatchStatus == MatchStatus.InRunning;

            if (shouldFastTrackReconnect && ProcessResourceHook != null)
            {
                _logger.InfoFormat("Fixture will be reset to creation queue fixtureId={0}", listener.FixtureId);
                ProcessResourceHook(listener.FixtureId);
            }
        }
コード例 #2
0
        private void RaiseEvent(EventHandler <StreamListenerEventArgs> eventToRaise, Exception exception = null, Fixture fixture = null)
        {
            if (eventToRaise == null)
            {
                return;
            }

            try
            {
                var eventArgs = new StreamListenerEventArgs
                {
                    CurrentSequence = fixture != null ? fixture.Sequence : _currentSequence,
                    Epoch           = fixture != null ? fixture.Epoch : _currentEpoch,
                    Exception       = exception,
                    Listener        = this,
                };

                if (fixture != null)
                {
                    eventArgs.StartTime             = fixture.StartTime;
                    eventArgs.MatchStatus           = (MatchStatus?)(!string.IsNullOrWhiteSpace(fixture.MatchStatus) ? Enum.Parse(typeof(MatchStatus), fixture.MatchStatus) : null);
                    eventArgs.LastEpochChangeReason = fixture.LastEpochChangeReason;
                }

                eventArgs.IsSnapshot = fixture != null && fixture.Tags.Count > 0;
                if (eventArgs.IsSnapshot)
                {
                    eventArgs.Name = fixture.FixtureName;

                    eventArgs.CompetitionId = fixture.Tags.ContainsKey("SSLNCompetitionId")
                        ? fixture.Tags["SSLNCompetitionId"].ToString()
                        : null;

                    eventArgs.CompetitionName = fixture.Tags.ContainsKey("SSLNCompetitionName")
                        ? fixture.Tags["SSLNCompetitionName"].ToString()
                        : null;
                }

                eventToRaise(this, eventArgs);
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat("Error occured while raising event in fixtureId={0}", FixtureId);
                //DO NOT Rethrow - this would affect listener with event subscriber issues
            }
        }
コード例 #3
0
        private void OnStreamDisconnected(object sender, StreamListenerEventArgs e)
        {
            var listener = e.Listener;
            var shouldFastTrackReconnect = !listener.IsFixtureDeleted && listener.IsDisconnected && e.MatchStatus == MatchStatus.InRunning;

            if (shouldFastTrackReconnect && ProcessResourceHook != null)
            {
                _logger.InfoFormat("Fixture will be reset to creation queue fixtureId={0}",listener.FixtureId);
                ProcessResourceHook(listener.FixtureId);
            }
        }
コード例 #4
0
        private void RaiseEvent(EventHandler<StreamListenerEventArgs> eventToRaise, Exception exception = null, Fixture fixture = null)
        {
            if (eventToRaise == null)
                return;

            try
            {
                var eventArgs = new StreamListenerEventArgs
                {
                    CurrentSequence = fixture != null ? fixture.Sequence : _currentSequence,
                    Epoch = fixture != null ? fixture.Epoch : _currentEpoch,
                    Exception = exception,
                    Listener = this,
                };

                if (fixture != null)
                {
                    eventArgs.StartTime = fixture.StartTime;
                    eventArgs.MatchStatus = (MatchStatus?)(!string.IsNullOrWhiteSpace(fixture.MatchStatus) ? Enum.Parse(typeof(MatchStatus), fixture.MatchStatus) : null);
                    eventArgs.LastEpochChangeReason = fixture.LastEpochChangeReason;
                }

                eventArgs.IsSnapshot = fixture != null && fixture.Tags.Count > 0;
                if (eventArgs.IsSnapshot)
                {
                    eventArgs.Name = fixture.FixtureName;

                    eventArgs.CompetitionId = fixture.Tags.ContainsKey("SSLNCompetitionId")
                        ? fixture.Tags["SSLNCompetitionId"].ToString()
                        : null;

                    eventArgs.CompetitionName = fixture.Tags.ContainsKey("SSLNCompetitionName")
                        ? fixture.Tags["SSLNCompetitionName"].ToString()
                        : null;
                }

                eventToRaise(this, eventArgs);
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat("Error occured while raising event in fixtureId={0}", FixtureId);
                //DO NOT Rethrow - this would affect listener with event subscriber issues
            }


        }