public void Run(MessageInterest messageInterest) { Console.WriteLine(string.Empty); _log.Info("Running the OddsFeed SDK Specific Dispatchers 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(); _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); var matchEventsProcessor = new SpecificEntityProcessor <IMatch>(_log, matchDispatcher); var stageEventsProcessor = new SpecificEntityProcessor <IStage>(_log, stageDispatcher); var tournamentEventsProcessor = new SpecificEntityProcessor <ITournament>(_log, tournamentDispatcher); var basicTournamentEventsProcessor = new SpecificEntityProcessor <IBasicTournament>(_log, basicTournamentDispatcher); var seasonEventsProcessor = new SpecificEntityProcessor <ISeason>(_log, seasonDispatcher); _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("Stopped"); }
public void Run(MessageInterest messageInterest) { _log.Info("Running the OddsFeed SDK MultiThreaded example"); _log.Info("Retrieving configuration from application configuration file"); var configuration = Feed.GetConfigurationBuilder().BuildFromConfigFile(); //you can also create the IOddsFeedConfiguration instance by providing required values //var configuration = Feed.CreateConfiguration("myAccessToken", new[] {"en"}); _log.Info("Creating Feed instance"); var oddsFeed = new Feed(configuration); _log.Info("Creating IOddsFeedSession"); var session = oddsFeed.CreateBuilder() .SetMessageInterest(messageInterest) .Build(); _log.Info("Attaching to feed events"); AttachToFeedEvents(oddsFeed); AttachToSessionEvents(session); _log.Info("Opening the feed instance"); oddsFeed.Open(); _log.Info("Starting the consumer thread"); var thread = new Thread(ThreadStart); thread.Start(); _log.Info("Example successfully started. Hit <enter> to quit"); Console.WriteLine(string.Empty); Console.ReadLine(); _log.Info("Closing / disposing the feed"); thread.Abort(); oddsFeed.Close(); DetachFromFeedEvents(oddsFeed); DetachFromSessionEvents(session); _log.Info("Stopped"); }
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() { _log.Info("Running the OddsFeed SDK Multi-Session example"); var configuration = Feed.GetConfigurationBuilder().SetAccessTokenFromConfigFile().SelectIntegration().LoadFromConfigFile().Build(); var oddsFeed = new Feed(configuration); AttachToFeedEvents(oddsFeed); _log.Info("Creating IOddsFeedSessions"); var sessionHigh = oddsFeed.CreateBuilder() .SetMessageInterest(MessageInterest.HighPriorityMessages) .Build(); var sessionLow = oddsFeed.CreateBuilder() .SetMessageInterest(MessageInterest.LowPriorityMessages) .Build(); _log.Info("Attaching to events for session with message interest 'HighPriorityMessages'"); AttachToSessionHighEvents(sessionHigh); _log.Info("Attaching to events for session with message interest 'LowPriorityMessages'"); AttachToSessionLowEvents(sessionLow); _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); DetachFromSessionHighEvents(sessionHigh); DetachFromSessionLowEvents(sessionLow); _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"); }