public void Run(MessageInterest messageInterest, CultureInfo culture) { _log.Info("Running the OddsFeed SDK Display Markets Names example"); _log.Info("Retrieving configuration from application configuration file"); var configuration = Feed.GetConfigurationBuilder().SetAccessTokenFromConfigFile().SelectIntegration().LoadFromConfigFile().Build(); _log.Info("Creating Feed instance"); var oddsFeed = new Feed(configuration); _log.Info("Creating IOddsFeedSession"); var session = oddsFeed.CreateBuilder() .SetMessageInterest(messageInterest) .Build(); _culture = culture; _marketWriter = new MarketWriter(_log, _taskProcessor, _culture); _log.Info("Attaching to feed events"); AttachToFeedEvents(oddsFeed); AttachToSessionEvents(session); _log.Info("Opening the feed instance"); oddsFeed.Open(); _log.Info("Example successfully started. Hit <enter> to quit"); Console.WriteLine(string.Empty); Console.ReadLine(); _log.Info("Closing / disposing the feed"); oddsFeed.Close(); DetachFromFeedEvents(oddsFeed); DetachFromSessionEvents(session); _log.Info("Waiting for asynchronous operations to complete"); var waitResult = _taskProcessor.WaitForTasks(); _log.Info($"Waiting for tasks completed. Result:{waitResult}"); _log.Info("Stopped"); }
public void Run(MessageInterest messageInterest, CultureInfo culture) { Console.WriteLine(string.Empty); _log.Info("Running the OddsFeed SDK Complete example"); var configuration = Feed.GetConfigurationBuilder().SetAccessTokenFromConfigFile().SelectIntegration().LoadFromConfigFile().Build(); var oddsFeed = new Feed(configuration); AttachToFeedEvents(oddsFeed); _log.Info("Creating IOddsFeedSessions"); var session = oddsFeed.CreateBuilder() .SetMessageInterest(messageInterest) .Build(); _culture = culture; var marketWriter = new MarketWriter(_log, _taskProcessor, _culture); var sportEntityWriter = new SportEntityWriter(_taskProcessor, _culture); _log.Info("Creating entity specific dispatchers"); var matchDispatcher = session.CreateSportSpecificMessageDispatcher <IMatch>(); var stageDispatcher = session.CreateSportSpecificMessageDispatcher <IStage>(); var tournamentDispatcher = session.CreateSportSpecificMessageDispatcher <ITournament>(); var basicTournamentDispatcher = session.CreateSportSpecificMessageDispatcher <IBasicTournament>(); var seasonDispatcher = session.CreateSportSpecificMessageDispatcher <ISeason>(); _log.Info("Creating event processors"); var defaultEventsProcessor = new EntityProcessor <ISportEvent>(session, sportEntityWriter, marketWriter); var matchEventsProcessor = new SpecificEntityProcessor <IMatch>(_log, matchDispatcher, sportEntityWriter, marketWriter); var stageEventsProcessor = new SpecificEntityProcessor <IStage>(_log, stageDispatcher, sportEntityWriter, marketWriter); var tournamentEventsProcessor = new SpecificEntityProcessor <ITournament>(_log, tournamentDispatcher, sportEntityWriter, marketWriter); var basicTournamentEventsProcessor = new SpecificEntityProcessor <IBasicTournament>(_log, basicTournamentDispatcher, sportEntityWriter, marketWriter); var seasonEventsProcessor = new SpecificEntityProcessor <ISeason>(_log, seasonDispatcher, sportEntityWriter, marketWriter); _log.Info("Opening event processors"); defaultEventsProcessor.Open(); matchEventsProcessor.Open(); stageEventsProcessor.Open(); tournamentEventsProcessor.Open(); basicTournamentEventsProcessor.Open(); seasonEventsProcessor.Open(); _log.Info("Opening the feed instance"); oddsFeed.Open(); _log.Info("Example successfully started. Hit <enter> to quit"); Console.WriteLine(string.Empty); Console.ReadLine(); _log.Info("Closing / disposing the feed"); oddsFeed.Close(); DetachFromFeedEvents(oddsFeed); _log.Info("Closing event processors"); defaultEventsProcessor.Close(); matchEventsProcessor.Close(); stageEventsProcessor.Close(); tournamentEventsProcessor.Close(); basicTournamentEventsProcessor.Close(); seasonEventsProcessor.Close(); _log.Info("Waiting for asynchronous operations to complete"); var waitResult = _taskProcessor.WaitForTasks(); _log.Info($"Waiting for tasks completed. Result:{waitResult}"); _log.Info("Stopped"); }