public TrackedRetrieval(ILogger <TrackedRetrieval> logger, Func <Uri, IDataRetriever> retrieverFactory, RetrieveConfiguration config, IResilience resilience)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (config.LongRetryCodes == null)
            {
                throw new ArgumentNullException(nameof(config.LongRetryCodes));
            }

            this.retrieverFactory = retrieverFactory ?? throw new ArgumentNullException(nameof(retrieverFactory));
            this.resilience       = resilience ?? throw new ArgumentNullException(nameof(resilience));
            this.logger           = logger ?? throw new ArgumentNullException(nameof(logger));
            ResetCookies();
        }
예제 #2
0
        public RedisLink(ILoggerFactory loggerFactory,
                         IRedisConfiguration configuration,
                         IRedisMultiplexer multiplexer,
                         IResilience resilience,
                         IEntitySubscriber entitySubscriber,
                         IDataSerializer defaultSerialiser)
            : base(configuration?.ServiceName)
        {
            this.loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
            Multiplexer        = multiplexer ?? throw new ArgumentNullException(nameof(multiplexer));

            Resilience             = resilience ?? throw new ArgumentNullException(nameof(resilience));
            EntitySubscriber       = entitySubscriber;
            this.defaultSerialiser = defaultSerialiser ?? throw new ArgumentNullException(nameof(defaultSerialiser));
            log                     = loggerFactory.CreateLogger <RedisLink>();
            Generator               = new ScriptGenerator();
            IndexManager            = new MainIndexManager(new IndexManagerFactory(loggerFactory, this));
            Client                  = new RedisClient(loggerFactory?.CreateLogger <RedisClient>(), this, IndexManager);
            PersistencyRegistration = new PersistencyRegistrationHandler(loggerFactory, this);
        }
예제 #3
0
        public virtual async Task Setup()
        {
            redisInstance = new RedisInside.Redis(i => i.Port(6666).LogTo(item => Global.Logger.LogDebug(item)));
            var config   = XDocument.Load(Path.Combine(TestContext.CurrentContext.TestDirectory, @"Config\redis.config")).XmlDeserialize <RedisConfiguration>();
            var provider = new ModuleHelper(config).Provider;

            Redis = await provider.GetService <IAsyncServiceFactory <IRedisLink> >().GetService(true);

            Redis.Multiplexer.Flush();

            Resilience            = provider.GetService <IResilience>();
            Key                   = new ObjectKey("Key1");
            Routing               = new Identity();
            Routing.ApplicationId = "Test";
            Routing.Environment   = "DEV";
            Repository            = new Mock <ILimitedSizeRepository>();
            Repository.Setup(item => item.Name).Returns("Test");
            Repository.Setup(item => item.Size).Returns(2);
            RepositoryKey = new RepositoryKey(Repository.Object, Key);
            ListAll       = new IndexKey(Repository.Object, "All", true);
            ListAll2      = new IndexKey(Repository.Object, "All2", true);
        }
예제 #4
0
 public GenericClientFactory(ILoggerFactory logger, HttpClient client, IResilience resilience)
 {
     this.logger     = logger ?? throw new ArgumentNullException(nameof(logger));
     this.client     = client ?? throw new ArgumentNullException(nameof(client));
     this.resilience = resilience ?? throw new ArgumentNullException(nameof(resilience));
 }
예제 #5
0
 public ResilientApiClient(IApiClient client, IResilience resilience)
 {
     this.client     = client;
     this.resilience = resilience;
 }