Exemplo n.º 1
0
        private IEasyCachingBus CreateDecoratedProvider() =>
        ServiceBuilders.CreateFakeBus(options =>
        {
            options.BusFactory = CreateBus;

            options.DecorateWithPublishFallback(
                exceptionFilter: exception => exception is InvalidOperationException);
        });
Exemplo n.º 2
0
        private IEasyCachingBus CreateDecoratedProvider() =>
        ServiceBuilders.CreateFakeBus(options =>
        {
            options.BusFactory = CreateBus;

            options.DecorateWithRetry(
                retryCount: 1,
                exceptionFilter: exception => exception is InvalidOperationException);
        });
Exemplo n.º 3
0
        protected IEasyCachingProvider CreateDecoratedProvider() =>
        ServiceBuilders.CreateFakeProvider(options =>
        {
            options.ProviderFactory = CreateProvider;

            var circuitBreakerParameters = new CircuitBreakerParameters(
                exceptionsAllowedBeforeBreaking: 1,
                durationOfBreak: TimeSpan.FromMinutes(1));

            options.DecorateWithCircuitBreaker(
                initParameters: circuitBreakerParameters,
                executeParameters: circuitBreakerParameters,
                exception => exception is InvalidOperationException);
        });
Exemplo n.º 4
0
        protected IEasyCachingBus CreateDecoratedProvider() =>
        ServiceBuilders.CreateFakeBus(options =>
        {
            options.BusFactory = CreateBus;

            var circuitBreakerParameters = new CircuitBreakerParameters(
                exceptionsAllowedBeforeBreaking: 1,
                durationOfBreak: TimeSpan.FromMinutes(1));

            options.DecorateWithCircuitBreaker(
                initParameters: circuitBreakerParameters,
                executeParameters: circuitBreakerParameters,
                subscribeRetryInterval: TimeSpan.FromMilliseconds(1),
                exceptionFilter: exception => exception is InvalidOperationException);
        });
Exemplo n.º 5
0
        public static IEasyCachingProvider CreateDecoratedProvider(
            Func <IEasyCachingProvider> providerFactory, IEasyCachingProvider fallbackProvider) =>
        ServiceBuilders.CreateFakeProvider(options =>
        {
            options.ProviderFactory = providerFactory;

            var circuitBreakerParameters = new CircuitBreakerParameters(
                exceptionsAllowedBeforeBreaking: 1,
                durationOfBreak: TimeSpan.FromMinutes(1));

            options
            .DecorateWithCircuitBreaker(
                initParameters: circuitBreakerParameters,
                executeParameters: circuitBreakerParameters,
                exception => exception is InvalidOperationException)
            .DecorateWithFallback(
                (_, __) => fallbackProvider,
                exception => exception is InvalidOperationException);
        });