Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Feed"/> class
        /// </summary>
        /// <param name="config">A <see cref="IOddsFeedConfiguration"/> instance representing feed configuration</param>
        /// <param name="isReplay">Value indicating whether the constructed instance will be used to connect to replay server</param>
        /// <param name="loggerFactory">A <see cref="ILoggerFactory"/> used to create <see cref="ILogger"/> used within sdk</param>
        /// <param name="metricsRoot">A <see cref="IMetricsRoot"/> used to provide metrics within sdk</param>
        protected Feed(IOddsFeedConfiguration config, bool isReplay, ILoggerFactory loggerFactory = null, IMetricsRoot metricsRoot = null)
        {
            Guard.Argument(config, nameof(config)).NotNull();

            FeedInitialized = false;

            UnityContainer = new UnityContainer();
            UnityContainer.RegisterBaseTypes(config, loggerFactory, metricsRoot);
            InternalConfig = UnityContainer.Resolve <IOddsFeedConfigurationInternal>();
            if (isReplay || InternalConfig.Environment == SdkEnvironment.Replay)
            {
                InternalConfig.EnableReplayServer();
            }

            _log = SdkLoggerFactory.GetLoggerForExecution(typeof(Feed));

            LogInit();

            _metricsRoot          = UnityContainer.Resolve <IMetricsRoot>();
            _metricsLogger        = SdkLoggerFactory.GetLoggerForStats(typeof(Feed));
            _metricsTaskScheduler = new AppMetricsTaskScheduler(
                TimeSpan.FromSeconds(InternalConfig.StatisticsTimeout),
                async() => { await LogMetricsAsync(); });
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProducerRecoveryManagerFactory"/> class.
        /// </summary>
        /// <param name="recoveryRequestIssuer">The <see cref="IRecoveryRequestIssuer"/> instance needed when creating <see cref="IProducerRecoveryManager"/> instances</param>
        /// <param name="messageMapper">The <see cref="IFeedMessageMapper"/> instance used to create <see cref="ISessionMessageManager"/> instances</param>
        /// <param name="config">The <see cref="IOddsFeedConfiguration"/> instance used to create <see cref="IProducerRecoveryManager"/> instances</param>
        public ProducerRecoveryManagerFactory(IRecoveryRequestIssuer recoveryRequestIssuer, IFeedMessageMapper messageMapper, IOddsFeedConfiguration config)
        {
            Guard.Argument(recoveryRequestIssuer, nameof(recoveryRequestIssuer)).NotNull();
            Guard.Argument(messageMapper, nameof(messageMapper)).NotNull();
            Guard.Argument(config, nameof(config)).NotNull();

            _recoveryRequestIssuer = recoveryRequestIssuer;
            _messageMapper         = messageMapper;
            _config = config;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReplayFeed"/> class
 /// </summary>
 /// <param name="config">A <see cref="IOddsFeedConfiguration" /> instance representing feed configuration.</param>
 /// <param name="loggerFactory">A <see cref="ILoggerFactory"/> used to create <see cref="ILogger"/> used within sdk</param>
 /// <param name="metricsRoot">A <see cref="IMetricsRoot"/> used to provide metrics within sdk</param>
 public ReplayFeed(IOddsFeedConfiguration config, ILoggerFactory loggerFactory = null, IMetricsRoot metricsRoot = null)
     : base(config, true, loggerFactory, metricsRoot)
 {
 }
        /// <inheritdoc />
        public TestFeed(IDataRouterManager dataRouterManager, IProducersProvider producersProvider, IOddsFeedConfiguration config, ILoggerFactory loggerFactory = null, IMetricsRoot metricsRoot = null)
            : base(config, loggerFactory, metricsRoot)
        {
            var bookmakerDetailsProviderMock = new Mock <BookmakerDetailsProvider>("bookmakerDetailsUriFormat",
                                                                                   new TestDataFetcher(),
                                                                                   new Deserializer <bookmaker_details>(),
                                                                                   new BookmakerDetailsMapperFactory());

            bookmakerDetailsProviderMock.Setup(x => x.GetData(It.IsAny <string>())).Returns(TestConfigurationInternal.GetBookmakerDetails());
            var defaultBookmakerDetailsProvider = bookmakerDetailsProviderMock.Object;

            InternalConfig = new OddsFeedConfigurationInternal(config, defaultBookmakerDetailsProvider);

            DataRouterManager = dataRouterManager;
            ProducersProvider = producersProvider;

            RecoveryDataPoster = new TestDataFetcher();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RecoveryRequestIssuer"/> class
        /// </summary>
        /// <param name="dataPoster">A <see cref="IDataPoster"/> instance used to issue the request to the feed API</param>
        /// <param name="sequenceGenerator">A <see cref="ISequenceGenerator"/> used to generate the sequence numbers</param>
        /// <param name="config">The <see cref="IOddsFeedConfiguration"/> used to get nodeId</param>
        public RecoveryRequestIssuer(IDataPoster dataPoster, ISequenceGenerator sequenceGenerator, IOddsFeedConfiguration config)
        {
            Contract.Requires(dataPoster != null);
            Contract.Requires(sequenceGenerator != null);
            Contract.Requires(config != null);

            _dataPoster        = dataPoster;
            _sequenceGenerator = sequenceGenerator;
            _nodeId            = config.NodeId;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RecoveryRequestIssuer"/> class
        /// </summary>
        /// <param name="dataPoster">A <see cref="IDataPoster"/> instance used to issue the request to the feed API</param>
        /// <param name="sequenceGenerator">A <see cref="ISequenceGenerator"/> used to generate the sequence numbers</param>
        /// <param name="config">The <see cref="IOddsFeedConfiguration"/> used to get nodeId</param>
        /// <param name="producerManager">The <see cref="IProducerManager"/> used to invoke RequestInitiated event</param>
        public RecoveryRequestIssuer(IDataPoster dataPoster, ISequenceGenerator sequenceGenerator, IOddsFeedConfiguration config, IProducerManager producerManager)
        {
            Guard.Argument(dataPoster, nameof(dataPoster)).NotNull();
            Guard.Argument(sequenceGenerator, nameof(sequenceGenerator)).NotNull();
            Guard.Argument(config, nameof(config)).NotNull();
            Guard.Argument(producerManager, nameof(producerManager)).NotNull();

            _dataPoster        = dataPoster;
            _sequenceGenerator = sequenceGenerator;
            _producerManager   = (ProducerManager)producerManager;
            _nodeId            = config.NodeId;
        }
Beispiel #7
0
 /// <summary>
 /// Constructs a new instance of the <see cref="Feed"/> class
 /// </summary>
 /// <param name="config">A <see cref="IOddsFeedConfiguration"/> instance representing feed configuration</param>
 /// <param name="loggerFactory">A <see cref="ILoggerFactory"/> used to create <see cref="ILogger"/> used within sdk</param>
 /// <param name="metricsRoot">A <see cref="IMetricsRoot"/> used to provide metrics within sdk</param>
 public Feed(IOddsFeedConfiguration config, ILoggerFactory loggerFactory = null, IMetricsRoot metricsRoot = null)
     : this(config, false, loggerFactory, metricsRoot)
 {
 }
Beispiel #8
0
 /// <summary>
 /// Constructs a new instance of the <see cref="Feed"/> class
 /// </summary>
 /// <param name="config">A <see cref="IOddsFeedConfiguration"/> instance representing feed configuration</param>
 public Feed(IOddsFeedConfiguration config)
     : this(config, false)
 {
 }
 public TestProducerManager(IProducersProvider producersProvider, IOddsFeedConfiguration config)
     : base(producersProvider, config)
 {
 }
Beispiel #10
0
 public TestConfigurationInternal(IOddsFeedConfiguration publicConfig, BookmakerDetailsDTO dto)
     : base(publicConfig, GetMock(dto))
 {
     Load();
 }
Beispiel #11
0
 /// <summary>
 /// Constructs a new instance of the <see cref="Feed"/> class
 /// </summary>
 /// <param name="config">A <see cref="IOddsFeedConfiguration"/> instance representing feed configuration</param>
 public FeedExt(IOddsFeedConfiguration config)
     : base(config)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReplayFeed"/> class
 /// </summary>
 /// <param name="config">A <see cref="IOddsFeedConfiguration" /> instance representing feed configuration.</param>
 public ReplayFeed(IOddsFeedConfiguration config)
     : base(config, true)
 {
 }
Beispiel #13
0
 /// <summary>
 /// Constructs a new instance of the <see cref="Feed"/> class
 /// </summary>
 /// <param name="config">A <see cref="IOddsFeedConfiguration"/> instance representing feed configuration</param>
 /// <param name="loggerFactory">A <see cref="ILoggerFactory"/> used to create <see cref="ILogger"/> used within sdk</param>
 /// <param name="metricsRoot">A <see cref="IMetricsRoot"/> used to provide metrics within sdk</param>
 public FeedExt(IOddsFeedConfiguration config, ILoggerFactory loggerFactory = null, IMetricsRoot metricsRoot = null)
     : base(config, loggerFactory, metricsRoot)
 {
 }
Beispiel #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProducerRecoveryManagerFactory"/> class.
        /// </summary>
        /// <param name="recoveryRequestIssuer">The <see cref="IRecoveryRequestIssuer"/> instance needed when creating <see cref="IProducerRecoveryManager"/> instances</param>
        /// <param name="messageMapper">The <see cref="IFeedMessageMapper"/> instance used to create <see cref="ISessionMessageManager"/> instances</param>
        /// <param name="config">The <see cref="IOddsFeedConfiguration"/> instance used to create <see cref="IProducerRecoveryManager"/> instances</param>
        public ProducerRecoveryManagerFactory(IRecoveryRequestIssuer recoveryRequestIssuer, IFeedMessageMapper messageMapper, IOddsFeedConfiguration config)
        {
            Contract.Requires(recoveryRequestIssuer != null);
            Contract.Requires(messageMapper != null);
            Contract.Requires(config != null);

            _recoveryRequestIssuer = recoveryRequestIssuer;
            _messageMapper         = messageMapper;
            _config = config;
        }
Beispiel #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReplayFeed"/> class
 /// </summary>
 /// <param name="config">A <see cref="IOddsFeedConfiguration" /> instance representing feed configuration.</param>
 public ReplayFeed(IOddsFeedConfiguration config)
     : base(config, true)
 {
     ReplayManager = CurrentUnityContainer.Resolve <IReplayManagerV1>();
     ((ProducerManager)ProducerManager).SetIgnoreRecovery(0);
 }