public DynamicGrainMethodInvoker(IParameterBinder parameterBinder, IOcelotLoggerFactory factory,
                                  JsonSerializer jsonSerializer)
 {
     this._parameterBinder = parameterBinder;
     this._logger          = factory.CreateLogger <DynamicGrainMethodInvoker>();
     this._jsonSerializer  = jsonSerializer;
 }
Esempio n. 2
0
        public ConsulFileConfigurationRepository(
            Cache.IOcelotCache <FileConfiguration> cache,
            IInternalConfigurationRepository repo,
            IConsulClientFactory factory,
            IOcelotLoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger <ConsulFileConfigurationRepository>();
            _cache  = cache;

            var internalConfig = repo.Get();

            var    consulHost = "localhost";
            var    consulPort = 8500;
            string token      = null;

            if (!internalConfig.IsError)
            {
                consulHost = string.IsNullOrEmpty(internalConfig.Data.ServiceProviderConfiguration?.Host) ? consulHost : internalConfig.Data.ServiceProviderConfiguration?.Host;
                consulPort = internalConfig.Data.ServiceProviderConfiguration?.Port ?? consulPort;
                token      = internalConfig.Data.ServiceProviderConfiguration?.Token;
            }

            var config = new ConsulRegistryConfiguration(consulHost, consulPort, OcelotConfiguration, token);

            _consul = factory.Get(config);
        }
Esempio n. 3
0
        public PollyQoSProvider(ReRoute reRoute, IOcelotLoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger <PollyQoSProvider>();

            _timeoutPolicy = Policy.TimeoutAsync(TimeSpan.FromMilliseconds(reRoute.QosOptionsOptions.TimeoutValue), reRoute.QosOptionsOptions.TimeoutStrategy);

            _circuitBreakerPolicy = Policy
                                    .Handle <HttpRequestException>()
                                    .Or <TimeoutRejectedException>()
                                    .Or <TimeoutException>()
                                    .CircuitBreakerAsync(
                exceptionsAllowedBeforeBreaking: reRoute.QosOptionsOptions.ExceptionsAllowedBeforeBreaking,
                durationOfBreak: TimeSpan.FromMilliseconds(reRoute.QosOptionsOptions.DurationOfBreak),
                onBreak: (ex, breakDelay) =>
            {
                _logger.LogError(
                    ".Breaker logging: Breaking the circuit for " + breakDelay.TotalMilliseconds + "ms!", ex);
            },
                onReset: () =>
            {
                _logger.LogDebug(".Breaker logging: Call ok! Closed the circuit again.");
            },
                onHalfOpen: () =>
            {
                _logger.LogDebug(".Breaker logging: Half-open; next call is a trial.");
            }
                );

            _circuitBreaker = new CircuitBreaker(_circuitBreakerPolicy, _timeoutPolicy);
        }
 public PollyCircuitBreakingDelegatingHandler(
     IQoSProvider qoSProvider,
     IOcelotLogger logger)
 {
     _qoSProvider = qoSProvider;
     _logger      = logger;
 }
Esempio n. 5
0
 public FileOcelotConfigurationCreator(
     IOptions <FileConfiguration> options,
     IConfigurationValidator configurationValidator,
     IOcelotLoggerFactory loggerFactory,
     ILoadBalancerFactory loadBalancerFactory,
     ILoadBalancerHouse loadBalancerHouse,
     IQoSProviderFactory qoSProviderFactory,
     IQosProviderHouse qosProviderHouse,
     IClaimsToThingCreator claimsToThingCreator,
     IAuthenticationOptionsCreator authOptionsCreator,
     IUpstreamTemplatePatternCreator upstreamTemplatePatternCreator,
     IRequestIdKeyCreator requestIdKeyCreator,
     IServiceProviderConfigurationCreator serviceProviderConfigCreator,
     IQoSOptionsCreator qosOptionsCreator,
     IReRouteOptionsCreator fileReRouteOptionsCreator,
     IRateLimitOptionsCreator rateLimitOptionsCreator
     )
 {
     _rateLimitOptionsCreator        = rateLimitOptionsCreator;
     _requestIdKeyCreator            = requestIdKeyCreator;
     _upstreamTemplatePatternCreator = upstreamTemplatePatternCreator;
     _authOptionsCreator             = authOptionsCreator;
     _loadBalanceFactory             = loadBalancerFactory;
     _loadBalancerHouse      = loadBalancerHouse;
     _qoSProviderFactory     = qoSProviderFactory;
     _qosProviderHouse       = qosProviderHouse;
     _options                = options;
     _configurationValidator = configurationValidator;
     _logger = loggerFactory.CreateLogger <FileOcelotConfigurationCreator>();
     _claimsToThingCreator         = claimsToThingCreator;
     _serviceProviderConfigCreator = serviceProviderConfigCreator;
     _qosOptionsCreator            = qosOptionsCreator;
     _fileReRouteOptionsCreator    = fileReRouteOptionsCreator;
 }
Esempio n. 6
0
 public AbpEfCoreFileConfigurationRepository(ConfigCacheOptions option, IOcelotCache <FileConfiguration> cache, IOcelotRepository ocelotGlobalConfigurationRepository, IOcelotLoggerFactory loggerFactory)
 {
     _ocelotGlobalConfigurationRepository = ocelotGlobalConfigurationRepository;
     _option = option;
     _cache  = cache;
     _logger = loggerFactory.CreateLogger <AbpEfCoreFileConfigurationRepository>();
 }
Esempio n. 7
0
 public Etcd(EtcdRegistryConfiguration config, IOcelotLoggerFactory factory, IEtcdClientFactory clientFactory)
 {
     logger                 = factory.CreateLogger <Etcd>();
     this.config            = config;
     this.etcdClientFactory = clientFactory;
     Services               = new List <Service>();
 }
 public ServiceFabricEndpointDiscovery(FabricClient fabricClient, IServicePartitionResolver servicePartitionResolver, IOptions <ServiceFabricProviderOptions> options, IOcelotLoggerFactory factory)
 {
     _fabricClient             = fabricClient;
     _servicePartitionResolver = servicePartitionResolver;
     _options = options.Value;
     _logger  = factory.CreateLogger <ServiceFabricEndpointDiscovery>();
 }
Esempio n. 9
0

        
Esempio n. 10
0
 public ReRouteRequestIdMiddleware(OcelotRequestDelegate next,
                                   IOcelotLoggerFactory loggerFactory,
                                   IRequestScopedDataRepository requestScopedDataRepository)
 {
     _next = next;
     _requestScopedDataRepository = requestScopedDataRepository;
     _logger = loggerFactory.CreateLogger <ReRouteRequestIdMiddleware>();
 }
Esempio n. 11
0
 public ExceptionHandlerMiddleware(RequestDelegate next,
                                   IOcelotLoggerFactory loggerFactory,
                                   IRequestScopedDataRepository requestScopedDataRepository)
 {
     _next = next;
     _requestScopedDataRepository = requestScopedDataRepository;
     _logger = loggerFactory.CreateLogger <ExceptionHandlerMiddleware>();
 }
 public DefaultRouteValuesBuilder(IOptions <OrleansHttpGatewayOptions> options
                                  , IOptions <OrleansRequesterConfiguration> config
                                  , IOcelotLoggerFactory factory)
 {
     this._config  = config?.Value;
     this._options = options.Value;
     this._logger  = factory.CreateLogger <DefaultRouteValuesBuilder>();
 }
Esempio n. 13
0
 public QueryStringBuilderMiddleware(OcelotRequestDelegate next,
                                     IOcelotLoggerFactory loggerFactory,
                                     IAddQueriesToRequest addQueriesToRequest)
 {
     _next = next;
     _addQueriesToRequest = addQueriesToRequest;
     _logger = loggerFactory.CreateLogger <QueryStringBuilderMiddleware>();
 }
        public ConsulServiceDiscoveryProvider(ConsulRegistryConfiguration config, IOcelotLoggerFactory factory, IConsulClientFactory clientFactory)
        {
            ;
            _logger = factory.CreateLogger <ConsulServiceDiscoveryProvider>();

            _config = config;
            _consul = clientFactory.Get(_config);
        }
Esempio n. 15
0
 public HttpClientHttpRequester(IOcelotLoggerFactory loggerFactory,
                                IHttpClientCache cacheHandlers,
                                IDelegatingHandlerHandlerFactory house)
 {
     _logger        = loggerFactory.CreateLogger <HttpClientHttpRequester>();
     _cacheHandlers = cacheHandlers;
     _factory       = house;
 }
Esempio n. 16
0
 public HttpClientBuilder(
     IDelegatingHandlerHandlerFactory factory,
     IHttpClientCache cacheHandlers,
     IOcelotLogger logger)
 {
     _factory       = factory;
     _cacheHandlers = cacheHandlers;
     _logger        = logger;
 }
 public ClientRateLimitMiddleware(OcelotRequestDelegate next,
                                  IOcelotLoggerFactory loggerFactory,
                                  IRateLimitCounterHandler counterHandler)
 {
     _next           = next;
     _logger         = loggerFactory.CreateLogger <ClientRateLimitMiddleware>();
     _counterHandler = counterHandler;
     _processor      = new ClientRateLimitProcessor(counterHandler);
 }
Esempio n. 18
0
 public SecurityMiddleware(IOcelotLoggerFactory loggerFactory,
                           IEnumerable <ISecurityPolicy> securityPolicies,
                           OcelotRequestDelegate next)
     : base(loggerFactory.CreateLogger <SecurityMiddleware>())
 {
     _logger           = loggerFactory.CreateLogger <SecurityMiddleware>();
     _securityPolicies = securityPolicies;
     _next             = next;
 }
Esempio n. 19
0
 public RaftController(INode node, IOcelotLoggerFactory loggerFactory, IWebHostBuilder builder)
 {
     _jsonSerialiserSettings = new JsonSerializerSettings {
         TypeNameHandling = TypeNameHandling.All
     };
     _baseSchemeUrlAndPort = builder.GetSetting(WebHostDefaults.ServerUrlsKey);
     _logger = loggerFactory.CreateLogger <RaftController>();
     _node   = node;
 }
 public HttpDiscoveryClientHttpRequester(IOcelotLoggerFactory loggerFactory,
                                         IHttpClientCache cacheHandlers,
                                         IDelegatingHandlerHandlerHouse house, IDiscoveryClient discoveryClient)
 {
     _logger          = loggerFactory.CreateLogger <HttpClientHttpRequester>();
     _cacheHandlers   = cacheHandlers;
     _house           = house;
     _discoveryClient = discoveryClient;
 }