private void ProcessFixtureDelete(Fixture fixtureDelta) { IsFixtureDeleted = true; _logger.InfoFormat("{0} has been deleted from the GTP Fixture Factory. Suspending all markets and stopping the stream.", _resource); try { SuspendFixture(SuspensionReason.FIXTURE_DELETED); _platformConnector.ProcessFixtureDeletion(fixtureDelta); } catch (Exception e) { _logger.Error( string.Format("An exception occured while trying to process fixture deletion for {0}", _resource), e); } var status = (MatchStatus)Enum.Parse(typeof(MatchStatus), fixtureDelta.MatchStatus); //reset event state _marketsRuleManager.OnFixtureUnPublished(); _eventState.UpdateFixtureState(_resource.Sport, fixtureDelta.Id, -1, status, _currentEpoch); RaiseEvent(OnFlagsChanged); }
private void ProcessFixtureDelete(Fixture fixtureDelta) { _logger.Info( $"{_resource} has been deleted from the GTP Fixture Factory. Suspending all markets and stopping the stream."); Fixture fixtureDeleted = new Fixture { Id = _fixtureId, FixtureName = fixtureDelta.FixtureName, MatchStatus = ((int)MatchStatus.Deleted).ToString() }; if (_marketsRuleManager.CurrentState != null) { fixtureDeleted.Sequence = _marketsRuleManager.CurrentState.FixtureSequence; } try { SuspendFixture(SuspensionReason.FIXTURE_DELETED); try { _streamStatsActor.Tell(new UpdatePluginStatsStartMsg() { Fixture = fixtureDelta, Sequence = fixtureDelta.Sequence, IsSnapshot = false, UpdateReceivedAt = DateTime.UtcNow, PluginMethod = "ProcessFixtureDeletion" }); _platformConnector.ProcessFixtureDeletion(fixtureDeleted); _streamStatsActor.Tell(new UpdatePluginStatsFinishMsg { CompletedAt = DateTime.UtcNow }); } catch (Exception ex) { var pluginError = new PluginException($"Plugin ProcessFixtureDeletion {fixtureDeleted} error occured", ex); UpdateStatsError(pluginError); throw pluginError; } } catch (Exception e) { _logger.Error($"An exception occured while trying to process fixture deletion for {_resource}", e); throw; } //reset fixture state _marketsRuleManager.OnFixtureUnPublished(); var fixtureStateActor = Context.System.ActorSelection(FixtureStateActor.Path); var updateFixtureStateMsg = new UpdateFixtureStateMsg { FixtureId = _fixtureId, Sport = _resource.Sport, Status = MatchStatus.Deleted, Sequence = -1, Epoch = _currentEpoch }; fixtureStateActor.Tell(updateFixtureStateMsg); }