コード例 #1
0
        private IEasyCachingBus CreateDecoratedProvider() =>
        ServiceBuilders.CreateFakeBus(options =>
        {
            options.BusFactory = CreateBus;

            options.DecorateWithPublishFallback(
                exceptionFilter: exception => exception is InvalidOperationException);
        });
コード例 #2
0
        private IEasyCachingBus CreateDecoratedProvider() =>
        ServiceBuilders.CreateFakeBus(options =>
        {
            options.BusFactory = CreateBus;

            options.DecorateWithRetry(
                retryCount: 1,
                exceptionFilter: exception => exception is InvalidOperationException);
        });
コード例 #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);
        });
コード例 #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);
        });
コード例 #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);
        });