Exemplo n.º 1
0
        public WikipediaClient(HttpClient client, IReadOnlyPolicyRegistry <string> policyRegistry)
        {
            client.BaseAddress = new Uri("https://en.wikipedia.org");

            _client      = client;
            _cachePolicy = policyRegistry.Get <IAsyncPolicy <HttpResponseMessage> >("WikipediaCachePolicy");
        }
Exemplo n.º 2
0
 public NewDeckOfCardsCommandHandler(ILogger <NewDeckOfCardsCommandHandler> logger, IDocumentStore db, IMapper mapper, IReadOnlyPolicyRegistry <string> registry)
 {
     _logger         = logger;
     _db             = db;
     _mapper         = mapper;
     _policyRegistry = registry;
 }
        public JsonPlaceholderClient(HttpClient httpClient, IReadOnlyPolicyRegistry <string> policyRegistry)
        {
            _httpClient = httpClient;

            // Resolve the caching policy to be used with this client
            _cachePolicy = policyRegistry.Get <AsyncCachePolicy <string> >("jsonPlaceHolderClientCachePolicy");
        }
 public UserStore(
     IdentityDbContext context,
     IReadOnlyPolicyRegistry <string> policyRegistry)
 {
     _context        = context;
     _policyRegistry = policyRegistry;
 }
Exemplo n.º 5
0
 public ChaosPolicyStore(
     OperationDbContext context,
     IReadOnlyPolicyRegistry <string> policyRegistry)
 {
     _context        = context;
     _policyRegistry = policyRegistry;
 }
Exemplo n.º 6
0
 public ObterCursosGsaGoogleQueryHandler(IMediator mediator, IReadOnlyPolicyRegistry <string> registry, GsaSyncOptions gsaSyncOptions)
     : base()
 {
     this.mediator       = mediator ?? throw new ArgumentNullException(nameof(mediator));
     this.gsaSyncOptions = gsaSyncOptions;
     this.policy         = registry.Get <IAsyncPolicy>(PoliticaPolly.PolicyGoogleSync);
 }
Exemplo n.º 7
0
 public TestClient(ITestConfiguration configuration, HttpClient client, IReadOnlyPolicyRegistry <string> policyRegistry, ILogger <TestClient> logger)
 {
     _client             = client;
     _policyRegistry     = policyRegistry;
     _logger             = logger;
     _client.BaseAddress = new Uri(configuration.BaseAddress);
 }
Exemplo n.º 8
0
 public InativarAlunoGoogleCommandHandler(IMediator mediator,
                                          IReadOnlyPolicyRegistry <string> registry,
                                          VariaveisGlobaisOptions variaveisGlobais) : base(variaveisGlobais)
 {
     this.mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
     this.policy   = registry.Get <IAsyncPolicy>(PoliticaPolly.PolicyGoogleSync);
 }
Exemplo n.º 9
0
 public CachedTeamListingDataSource(IReadOnlyPolicyRegistry <string> policyRegistry, ICacheableTeamListingDataSource teamListingDataSource, ITeamListingFilterSerializer teamListingFilterSerializer, ICacheOverride cacheOverride)
 {
     _policyRegistry              = policyRegistry ?? throw new ArgumentNullException(nameof(policyRegistry));
     _teamListingDataSource       = teamListingDataSource ?? throw new ArgumentNullException(nameof(teamListingDataSource));
     _teamListingFilterSerializer = teamListingFilterSerializer ?? throw new ArgumentNullException(nameof(teamListingFilterSerializer));
     _cacheOverride = cacheOverride ?? throw new ArgumentNullException(nameof(cacheOverride));
 }
        public DistanceModule(IConfiguration configuration, IReadOnlyPolicyRegistry <string> registry)
        {
            AirportServiceUri = new Uri(configuration["ExternalServices:0:AirportServiceUri"]);
            Registry          = registry;

            Get("api/distance/{from:iata}-{to:iata}", GetDistance);
        }
Exemplo n.º 11
0
 public CircuitBreakerPolicyStore(
     OperationDbContext context,
     IReadOnlyPolicyRegistry <string> policyRegistry)
 {
     _context        = context;
     _policyRegistry = policyRegistry;
 }
 public CachedCompetitionDataSource(IReadOnlyPolicyRegistry <string> policyRegistry, ICacheableCompetitionDataSource competitionDataSource, ICompetitionFilterSerializer competitionFilterSerializer, ICacheOverride cacheOverride)
 {
     _policyRegistry              = policyRegistry ?? throw new ArgumentNullException(nameof(policyRegistry));
     _competitionDataSource       = competitionDataSource ?? throw new ArgumentNullException(nameof(competitionDataSource));
     _competitionFilterSerializer = competitionFilterSerializer ?? throw new ArgumentNullException(nameof(competitionFilterSerializer));
     _cacheOverride = cacheOverride ?? throw new ArgumentNullException(nameof(cacheOverride));
 }
 public ClientStore(
     ConfigurationDbContext context,
     IReadOnlyPolicyRegistry <string> policyRegistry)
 {
     _context        = context;
     _policyRegistry = policyRegistry;
 }
 public RemoteStoreHttpClient(
     [NotNull] HttpClient client,
     IReadOnlyPolicyRegistry <string> policyRegistry)
 {
     _client      = client;
     _cachePolicy = policyRegistry.Get <IAsyncPolicy <TTenantInfo> >(typeof(TTenantInfo).Name);
 }
Exemplo n.º 15
0
 public CachedMatchLocationDataSource(IReadOnlyPolicyRegistry <string> policyRegistry, ICacheableMatchLocationDataSource matchLocationDataSource, IMatchLocationFilterSerializer matchLocationFilterSerializer, ICacheOverride cacheOverride)
 {
     _policyRegistry                = policyRegistry ?? throw new ArgumentNullException(nameof(policyRegistry));
     _matchLocationDataSource       = matchLocationDataSource ?? throw new ArgumentNullException(nameof(matchLocationDataSource));
     _matchLocationFilterSerializer = matchLocationFilterSerializer ?? throw new ArgumentNullException(nameof(matchLocationFilterSerializer));
     _cacheOverride = cacheOverride ?? throw new ArgumentNullException(nameof(cacheOverride));
 }
Exemplo n.º 16
0
 public Pump(
     IReadOnlyPolicyRegistry <string> policyRegistry,
     IStreamReader streamReader
     )
 {
     _policyRegistry = policyRegistry;
     _streamReader   = streamReader;
 }
Exemplo n.º 17
0
        public WikiDataClient(HttpClient client, IReadOnlyPolicyRegistry <string> policyRegistry, ILogger <WikiDataClient> logger)
        {
            client.BaseAddress = new Uri("https://www.wikidata.org");

            this.Client      = client;
            this.cachePolicy = policyRegistry.Get <IAsyncPolicy <HttpResponseMessage> >("WikiDataCachePolicy");
            this.logger      = logger;
        }
Exemplo n.º 18
0
 public FaceController(IRequisicaoService requisicao, ILogger <FaceController> logger,
                       IReadOnlyPolicyRegistry <string> policyRegistry)
 {
     _configurationService = configurationService;
     _requisicaoService    = requisicao;
     _policyRegistry       = policyRegistry;
     _logger = logger;
 }
        /// <summary>
        /// Creates a policy to use for an HTTP request.
        /// </summary>
        /// <param name="registry">The policy registry to use.</param>
        /// <param name="request">The HTTP request to get the policy for.</param>
        /// <returns>
        /// The policy to use for <paramref name="request"/>.
        /// </returns>
        private static IAsyncPolicy <HttpResponseMessage> GetRequestPolicy(
            IReadOnlyPolicyRegistry <string> registry,
            HttpRequestMessage request)
        {
            string policyName = request.Method == HttpMethod.Get ? "ReadPolicy" : "WritePolicy";

            return(registry.Get <IAsyncPolicy <HttpResponseMessage> >(policyName));
        }
Exemplo n.º 20
0
 public BuggyController(
     IReadOnlyPolicyRegistry <string> registry,
     TripwireHealthCheck tripWireHealthCheck, ForcedHealthCheck forcedHealthCheck)
 {
     this.registry          = registry;
     this.healthCheck       = tripWireHealthCheck;
     this.forcedHealthCheck = forcedHealthCheck;
 }
Exemplo n.º 21
0
 private IAsyncPolicy <HttpResponseMessage> PolicySelector(IReadOnlyPolicyRegistry <string> policyRegistry, HttpRequestMessage request)
 {
     if (request.Method == HttpMethod.Get)
     {
         return(policyRegistry.Get <IAsyncPolicy <HttpResponseMessage> >("SimpleRetry"));
     }
     return(policyRegistry.Get <IAsyncPolicy <HttpResponseMessage> >("NoOp"));
 }
Exemplo n.º 22
0
 public WidgetDeprecatedAwsSnsNotificationHandler(AmazonSimpleNotificationServiceClient snsClient, IConfiguration config,
                                                  ILogger <WidgetDeprecatedAwsSnsNotificationHandler> logger, IReadOnlyPolicyRegistry <string> registry)
 {
     _snsClient      = snsClient;
     _config         = config;
     _logger         = logger;
     _policyRegistry = registry;
 }
Exemplo n.º 23
0
 public UsersController(IConfiguration _config, ILogger <UsersController> logger,
                        IReadOnlyPolicyRegistry <string> policyRegistry)
 {
     config = _config;
     //RECEBE AS MENSAGENS ENVIAS POR NÒS COMO TESTE
     //new UserReceive().ReceiveMessages();
     _logger         = logger;
     _policyRegistry = policyRegistry;
 }
        public AdvancedCircuitBreakerHealth(IReadOnlyPolicyRegistry <string> registry)
        {
            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            _circuitBreakerPolicy = registry.Get <AsyncCircuitBreakerPolicy <HttpResponseMessage> >(PolicyConstants.ADVANCED_CIRCUITBREAKER_POLICY_NAME);
        }
Exemplo n.º 25
0
 public Battery(IConsole console, List <IHowitzer> howitzers, IReadOnlyPolicyRegistry <string> policyRegistry)
 {
     _console        = console;
     _howitzers      = howitzers;
     _policyRegistry = policyRegistry;
     foreach (var howitzer in _howitzers)
     {
         howitzer.AssignToBattery(this);
     }
 }
 public CardTemplateQueryHandler(ILogger <CardTemplateQueryHandler> logger, IDocumentStore context, IMapper mapper,
                                 ISieveProcessor sieveProc, IOptions <SieveOptions> sortFilterPagingOptions, IReadOnlyPolicyRegistry <string> registry)
 {
     _logger   = logger;
     _docStore = context;
     _mapper   = mapper;
     _sortFilterPagingProcessor = sieveProc;
     _sortFilterPagingOptions   = sortFilterPagingOptions;
     _policyRegistry            = registry;
 }
Exemplo n.º 27
0
 public UserProfileController(IGetCurrentUser getCurrentUser, IUserProfileService userProfileService,
                              ILogger <UserProfileController> logger,
                              ICacheManagementFactory cacheMgmtFactory,
                              IReadOnlyPolicyRegistry <string> cachePolicyRegistry)
 {
     this.getCurrentUser      = getCurrentUser;
     this.userProfileService  = userProfileService;
     this.logger              = logger;
     this.cacheMgmtFactory    = cacheMgmtFactory;
     this.cachePolicyRegistry = cachePolicyRegistry;
 }
Exemplo n.º 28
0
 public SeniorBatteryOfficer(
     DivisionControlUnit.DivisionControlUnitClient client,
     IBattery battery,
     IConsole console,
     IReadOnlyPolicyRegistry <string> policyRegistry)
 {
     _client         = client;
     _battery        = battery;
     _console        = console;
     _policyRegistry = policyRegistry;
 }
 public ExternalSiteContentController(
     IReadOnlyPolicyRegistry <string> policyRegistry,
     IWebsiteService websiteService,
     ISentimentAnalysisService sentimentAnalysisService,
     ILogger <ExternalSiteContentController> logger)
 {
     _policy                   = policyRegistry.Get <IAsyncPolicy <AnalysisResponse> >(Policies.AnalysisResponsePolicy);
     _websiteService           = websiteService;
     _sentimentAnalysisService = sentimentAnalysisService;
     _logger                   = logger;
 }
Exemplo n.º 30
0
 public Howitzer(
     int howitzerId,
     IConsole console,
     IReadOnlyPolicyRegistry <string> policyRegistry,
     DivisionControlUnit.DivisionControlUnitClient client)
 {
     _console        = console;
     _policyRegistry = policyRegistry;
     _client         = client;
     Id = howitzerId;
 }