Search in sources :

Example 56 with Flowable

use of io.reactivex.Flowable in project resilience4j by resilience4j.

the class RateLimiterChain method execute.

@Override
public void execute(Chain chain) throws Exception {
    String prefix = chain.getRegistry().get(Resilience4jConfig.class).getEndpoints().getRateLimiters().getPath();
    chain.prefix(prefix, chain1 -> {
        chain1.get("events", ctx -> Promise.<RateLimiterEventsEndpointResponse>async(d -> {
            List<RateLimiterEventDTO> eventsList = eventConsumerRegistry.getAllEventConsumer().flatMap(CircularEventConsumer::getBufferedEvents).sorted(Comparator.comparing(RateLimiterEvent::getCreationTime)).map(RateLimiterEventDTO::createRateLimiterEventDTO).toJavaList();
            d.success(new RateLimiterEventsEndpointResponse(eventsList));
        }).then(r -> ctx.render(Jackson.json(r))));
        chain1.get("stream/events", ctx -> {
            Seq<Flowable<RateLimiterEvent>> eventStreams = rateLimiterRegistry.getAllRateLimiters().map(rateLimiter -> RxJava2Adapter.toFlowable(rateLimiter.getEventPublisher()));
            Function<RateLimiterEvent, String> data = r -> Jackson.getObjectWriter(chain1.getRegistry()).writeValueAsString(RateLimiterEventDTO.createRateLimiterEventDTO(r));
            ServerSentEvents events = ServerSentEvents.serverSentEvents(Flowable.merge(eventStreams), e -> e.id(RateLimiterEvent::getRateLimiterName).event(c -> c.getEventType().name()).data(data));
            ctx.render(events);
        });
        chain1.get("events/:name", ctx -> {
            String rateLimiterName = ctx.getPathTokens().get("name");
            Promise.<RateLimiterEventsEndpointResponse>async(d -> {
                List<RateLimiterEventDTO> eventsList = eventConsumerRegistry.getEventConsumer(rateLimiterName).getBufferedEvents().sorted(Comparator.comparing(RateLimiterEvent::getCreationTime)).map(RateLimiterEventDTO::createRateLimiterEventDTO).toJavaList();
                d.success(new RateLimiterEventsEndpointResponse(eventsList));
            }).then(r -> ctx.render(Jackson.json(r)));
        });
        chain1.get("stream/events/:name", ctx -> {
            String rateLimiterName = ctx.getPathTokens().get("name");
            RateLimiter rateLimiter = rateLimiterRegistry.getAllRateLimiters().find(rL -> rL.getName().equals(rateLimiterName)).getOrElseThrow(() -> new IllegalArgumentException(String.format("rate limiter with name %s not found", rateLimiterName)));
            Function<RateLimiterEvent, String> data = r -> Jackson.getObjectWriter(chain1.getRegistry()).writeValueAsString(RateLimiterEventDTO.createRateLimiterEventDTO(r));
            ServerSentEvents events = ServerSentEvents.serverSentEvents(RxJava2Adapter.toFlowable(rateLimiter.getEventPublisher()), e -> e.id(RateLimiterEvent::getRateLimiterName).event(c -> c.getEventType().name()).data(data));
            ctx.render(events);
        });
        chain1.get("events/:name/:type", ctx -> {
            String rateLimiterName = ctx.getPathTokens().get("name");
            String eventType = ctx.getPathTokens().get("type");
            Promise.<RateLimiterEventsEndpointResponse>async(d -> {
                List<RateLimiterEventDTO> eventsList = eventConsumerRegistry.getEventConsumer(rateLimiterName).getBufferedEvents().sorted(Comparator.comparing(RateLimiterEvent::getCreationTime)).filter(event -> event.getEventType() == RateLimiterEvent.Type.valueOf(eventType.toUpperCase())).map(RateLimiterEventDTO::createRateLimiterEventDTO).toJavaList();
                d.success(new RateLimiterEventsEndpointResponse(eventsList));
            }).then(r -> ctx.render(Jackson.json(r)));
        });
        chain1.get("stream/events/:name/:type", ctx -> {
            String rateLimiterName = ctx.getPathTokens().get("name");
            String eventType = ctx.getPathTokens().get("type");
            RateLimiter rateLimiter = rateLimiterRegistry.getAllRateLimiters().find(rL -> rL.getName().equals(rateLimiterName)).getOrElseThrow(() -> new IllegalArgumentException(String.format("rate limiter with name %s not found", rateLimiterName)));
            Flowable<RateLimiterEvent> eventStream = RxJava2Adapter.toFlowable(rateLimiter.getEventPublisher()).filter(event -> event.getEventType() == RateLimiterEvent.Type.valueOf(eventType.toUpperCase()));
            Function<RateLimiterEvent, String> data = r -> Jackson.getObjectWriter(chain1.getRegistry()).writeValueAsString(RateLimiterEventDTO.createRateLimiterEventDTO(r));
            ServerSentEvents events = ServerSentEvents.serverSentEvents(eventStream, e -> e.id(RateLimiterEvent::getRateLimiterName).event(c -> c.getEventType().name()).data(data));
            ctx.render(events);
        });
    });
}
Also used : Function(ratpack.func.Function) RxJava2Adapter(io.github.resilience4j.adapter.RxJava2Adapter) RateLimiterEvent(io.github.resilience4j.ratelimiter.event.RateLimiterEvent) RateLimiter(io.github.resilience4j.ratelimiter.RateLimiter) Promise(ratpack.exec.Promise) Resilience4jConfig(io.github.resilience4j.ratpack.Resilience4jConfig) Jackson(ratpack.jackson.Jackson) ServerSentEvents(ratpack.sse.ServerSentEvents) Chain(ratpack.handling.Chain) Inject(javax.inject.Inject) List(java.util.List) Flowable(io.reactivex.Flowable) CircularEventConsumer(io.github.resilience4j.consumer.CircularEventConsumer) Action(ratpack.func.Action) Seq(io.vavr.collection.Seq) Comparator(java.util.Comparator) EventConsumerRegistry(io.github.resilience4j.consumer.EventConsumerRegistry) RateLimiterRegistry(io.github.resilience4j.ratelimiter.RateLimiterRegistry) Resilience4jConfig(io.github.resilience4j.ratpack.Resilience4jConfig) RateLimiterEvent(io.github.resilience4j.ratelimiter.event.RateLimiterEvent) RateLimiter(io.github.resilience4j.ratelimiter.RateLimiter) ServerSentEvents(ratpack.sse.ServerSentEvents) List(java.util.List) Flowable(io.reactivex.Flowable)

Example 57 with Flowable

use of io.reactivex.Flowable in project resilience4j by resilience4j.

the class RetryMethodInterceptor method invoke.

@SuppressWarnings("unchecked")
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    Retry annotation = invocation.getMethod().getAnnotation(Retry.class);
    io.github.resilience4j.retry.Retry retry = registry.retry(annotation.name());
    if (retry == null) {
        return invocation.proceed();
    }
    RecoveryFunction<?> recoveryFunction = annotation.recovery().newInstance();
    if (registry == null) {
        registry = RetryRegistry.ofDefaults();
    }
    Class<?> returnType = invocation.getMethod().getReturnType();
    if (Promise.class.isAssignableFrom(returnType)) {
        Promise<?> result = (Promise<?>) proceed(invocation, retry, recoveryFunction);
        if (result != null) {
            RetryTransformer transformer = RetryTransformer.of(retry).recover(recoveryFunction);
            result = result.transform(transformer);
        }
        return result;
    } else if (Observable.class.isAssignableFrom(returnType)) {
        Observable<?> result = (Observable<?>) proceed(invocation, retry, recoveryFunction);
        if (result != null) {
            io.github.resilience4j.retry.transformer.RetryTransformer transformer = io.github.resilience4j.retry.transformer.RetryTransformer.of(retry);
            result = result.compose(transformer).onErrorReturn(t -> recoveryFunction.apply((Throwable) t));
        }
        return result;
    } else if (Flowable.class.isAssignableFrom(returnType)) {
        Flowable<?> result = (Flowable<?>) proceed(invocation, retry, recoveryFunction);
        if (result != null) {
            io.github.resilience4j.retry.transformer.RetryTransformer transformer = io.github.resilience4j.retry.transformer.RetryTransformer.of(retry);
            result = result.compose(transformer).onErrorReturn(t -> recoveryFunction.apply((Throwable) t));
        }
        return result;
    } else if (Single.class.isAssignableFrom(returnType)) {
        Single<?> result = (Single<?>) proceed(invocation, retry, recoveryFunction);
        if (result != null) {
            io.github.resilience4j.retry.transformer.RetryTransformer transformer = io.github.resilience4j.retry.transformer.RetryTransformer.of(retry);
            result = result.compose(transformer).onErrorReturn(t -> recoveryFunction.apply((Throwable) t));
        }
        return result;
    } else if (CompletionStage.class.isAssignableFrom(returnType)) {
        CompletionStage stage = (CompletionStage) proceed(invocation, retry, recoveryFunction);
        return executeCompletionStage(invocation, stage, retry.context(), recoveryFunction);
    }
    return proceed(invocation, retry, recoveryFunction);
}
Also used : MethodInterceptor(org.aopalliance.intercept.MethodInterceptor) MethodInvocation(org.aopalliance.intercept.MethodInvocation) CompletionStage(java.util.concurrent.CompletionStage) Flowable(io.reactivex.Flowable) Inject(com.google.inject.Inject) Observable(io.reactivex.Observable) Promise(ratpack.exec.Promise) CompletableFuture(java.util.concurrent.CompletableFuture) RetryRegistry(io.github.resilience4j.retry.RetryRegistry) Single(io.reactivex.Single) RecoveryFunction(io.github.resilience4j.ratpack.recovery.RecoveryFunction) Observable(io.reactivex.Observable) Promise(ratpack.exec.Promise) Single(io.reactivex.Single) CompletionStage(java.util.concurrent.CompletionStage) Flowable(io.reactivex.Flowable)

Example 58 with Flowable

use of io.reactivex.Flowable in project resilience4j by resilience4j.

the class CircuitBreakerMethodInterceptor method invoke.

@SuppressWarnings("unchecked")
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    CircuitBreaker annotation = invocation.getMethod().getAnnotation(CircuitBreaker.class);
    RecoveryFunction<?> recoveryFunction = annotation.recovery().newInstance();
    if (registry == null) {
        registry = CircuitBreakerRegistry.ofDefaults();
    }
    io.github.resilience4j.circuitbreaker.CircuitBreaker breaker = registry.circuitBreaker(annotation.name());
    if (breaker == null) {
        return invocation.proceed();
    }
    Class<?> returnType = invocation.getMethod().getReturnType();
    if (Promise.class.isAssignableFrom(returnType)) {
        Promise<?> result = (Promise<?>) proceed(invocation, breaker, recoveryFunction);
        if (result != null) {
            CircuitBreakerTransformer transformer = CircuitBreakerTransformer.of(breaker).recover(recoveryFunction);
            result = result.transform(transformer);
        }
        return result;
    } else if (Observable.class.isAssignableFrom(returnType)) {
        Observable<?> result = (Observable<?>) proceed(invocation, breaker, recoveryFunction);
        if (result != null) {
            CircuitBreakerOperator operator = CircuitBreakerOperator.of(breaker);
            result = result.lift(operator).onErrorReturn(t -> recoveryFunction.apply((Throwable) t));
        }
        return result;
    } else if (Flowable.class.isAssignableFrom(returnType)) {
        Flowable<?> result = (Flowable<?>) proceed(invocation, breaker, recoveryFunction);
        if (result != null) {
            CircuitBreakerOperator operator = CircuitBreakerOperator.of(breaker);
            result = result.lift(operator).onErrorReturn(t -> recoveryFunction.apply((Throwable) t));
        }
        return result;
    } else if (Single.class.isAssignableFrom(returnType)) {
        Single<?> result = (Single<?>) proceed(invocation, breaker, recoveryFunction);
        if (result != null) {
            CircuitBreakerOperator operator = CircuitBreakerOperator.of(breaker);
            result = result.lift(operator).onErrorReturn(t -> recoveryFunction.apply((Throwable) t));
        }
        return result;
    } else if (CompletionStage.class.isAssignableFrom(returnType)) {
        final CompletableFuture promise = new CompletableFuture<>();
        if (breaker.isCallPermitted()) {
            CompletionStage<?> result = (CompletionStage<?>) proceed(invocation, breaker, recoveryFunction);
            if (result != null) {
                long start = System.nanoTime();
                result.whenComplete((v, t) -> {
                    long durationInNanos = System.nanoTime() - start;
                    if (t != null) {
                        breaker.onError(durationInNanos, t);
                        try {
                            promise.complete(recoveryFunction.apply((Throwable) t));
                        } catch (Exception e) {
                            promise.completeExceptionally(e);
                        }
                    } else {
                        breaker.onSuccess(durationInNanos);
                        promise.complete(v);
                    }
                });
            }
        } else {
            Throwable t = new CircuitBreakerOpenException(String.format("CircuitBreaker '%s' is open", breaker.getName()));
            try {
                promise.complete(recoveryFunction.apply((Throwable) t));
            } catch (Throwable t2) {
                promise.completeExceptionally(t2);
            }
        }
        return promise;
    }
    return proceed(invocation, breaker, recoveryFunction);
}
Also used : CircuitBreakerOperator(io.github.resilience4j.circuitbreaker.operator.CircuitBreakerOperator) Inject(com.google.inject.Inject) Promise(ratpack.exec.Promise) CompletableFuture(java.util.concurrent.CompletableFuture) CircuitBreakerOperator(io.github.resilience4j.circuitbreaker.operator.CircuitBreakerOperator) CircuitBreakerOpenException(io.github.resilience4j.circuitbreaker.CircuitBreakerOpenException) CircuitBreakerRegistry(io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry) Single(io.reactivex.Single) RecoveryFunction(io.github.resilience4j.ratpack.recovery.RecoveryFunction) MethodInterceptor(org.aopalliance.intercept.MethodInterceptor) MethodInvocation(org.aopalliance.intercept.MethodInvocation) CompletionStage(java.util.concurrent.CompletionStage) Flowable(io.reactivex.Flowable) Observable(io.reactivex.Observable) Observable(io.reactivex.Observable) CircuitBreakerOpenException(io.github.resilience4j.circuitbreaker.CircuitBreakerOpenException) CircuitBreakerOpenException(io.github.resilience4j.circuitbreaker.CircuitBreakerOpenException) Promise(ratpack.exec.Promise) CompletableFuture(java.util.concurrent.CompletableFuture) Single(io.reactivex.Single) CompletionStage(java.util.concurrent.CompletionStage) Flowable(io.reactivex.Flowable)

Example 59 with Flowable

use of io.reactivex.Flowable in project resilience4j by resilience4j.

the class CircuitBreakerChain method execute.

@Override
public void execute(Chain chain) throws Exception {
    String prefix = chain.getRegistry().get(Resilience4jConfig.class).getEndpoints().getCircuitBreakers().getPath();
    chain.prefix(prefix, chain1 -> {
        chain1.get("events", ctx -> Promise.<CircuitBreakerEventsEndpointResponse>async(d -> {
            CircuitBreakerEventsEndpointResponse response = new CircuitBreakerEventsEndpointResponse(eventConsumerRegistry.getAllEventConsumer().flatMap(CircularEventConsumer::getBufferedEvents).sorted(Comparator.comparing(CircuitBreakerEvent::getCreationTime)).map(CircuitBreakerEventDTOFactory::createCircuitBreakerEventDTO).toJavaList());
            d.success(response);
        }).then(r -> ctx.render(Jackson.json(r))));
        chain1.get("stream/events", ctx -> {
            Seq<Flowable<CircuitBreakerEvent>> eventStreams = circuitBreakerRegistry.getAllCircuitBreakers().map(circuitBreaker -> RxJava2Adapter.toFlowable(circuitBreaker.getEventPublisher()));
            Function<CircuitBreakerEvent, String> data = c -> Jackson.getObjectWriter(chain1.getRegistry()).writeValueAsString(CircuitBreakerEventDTOFactory.createCircuitBreakerEventDTO(c));
            ServerSentEvents events = ServerSentEvents.serverSentEvents(Flowable.merge(eventStreams), e -> e.id(CircuitBreakerEvent::getCircuitBreakerName).event(c -> c.getEventType().name()).data(data));
            ctx.render(events);
        });
        chain1.get("events/:name", ctx -> {
            String circuitBreakerName = ctx.getPathTokens().get("name");
            Promise.<CircuitBreakerEventsEndpointResponse>async(d -> {
                CircuitBreakerEventsEndpointResponse response = new CircuitBreakerEventsEndpointResponse(eventConsumerRegistry.getEventConsumer(circuitBreakerName).getBufferedEvents().map(CircuitBreakerEventDTOFactory::createCircuitBreakerEventDTO).toJavaList());
                d.success(response);
            }).then(r -> ctx.render(Jackson.json(r)));
        });
        chain1.get("stream/events/:name", ctx -> {
            String circuitBreakerName = ctx.getPathTokens().get("name");
            CircuitBreaker circuitBreaker = circuitBreakerRegistry.getAllCircuitBreakers().find(cb -> cb.getName().equals(circuitBreakerName)).getOrElseThrow(() -> new IllegalArgumentException(String.format("circuit breaker with name %s not found", circuitBreakerName)));
            Function<CircuitBreakerEvent, String> data = c -> Jackson.getObjectWriter(chain1.getRegistry()).writeValueAsString(CircuitBreakerEventDTOFactory.createCircuitBreakerEventDTO(c));
            ServerSentEvents events = ServerSentEvents.serverSentEvents(RxJava2Adapter.toFlowable(circuitBreaker.getEventPublisher()), e -> e.id(CircuitBreakerEvent::getCircuitBreakerName).event(c -> c.getEventType().name()).data(data));
            ctx.render(events);
        });
        chain1.get("events/:name/:type", ctx -> {
            String circuitBreakerName = ctx.getPathTokens().get("name");
            String eventType = ctx.getPathTokens().get("type");
            Promise.<CircuitBreakerEventsEndpointResponse>async(d -> {
                CircuitBreakerEventsEndpointResponse response = new CircuitBreakerEventsEndpointResponse(eventConsumerRegistry.getEventConsumer(circuitBreakerName).getBufferedEvents().filter(event -> event.getEventType() == CircuitBreakerEvent.Type.valueOf(eventType.toUpperCase())).map(CircuitBreakerEventDTOFactory::createCircuitBreakerEventDTO).toJavaList());
                d.success(response);
            }).then(r -> ctx.render(Jackson.json(r)));
        });
        chain1.get("stream/events/:name/:type", ctx -> {
            String circuitBreakerName = ctx.getPathTokens().get("name");
            String eventType = ctx.getPathTokens().get("type");
            CircuitBreaker circuitBreaker = circuitBreakerRegistry.getAllCircuitBreakers().find(cb -> cb.getName().equals(circuitBreakerName)).getOrElseThrow(() -> new IllegalArgumentException(String.format("circuit breaker with name %s not found", circuitBreakerName)));
            Flowable<CircuitBreakerEvent> eventStream = RxJava2Adapter.toFlowable(circuitBreaker.getEventPublisher()).filter(event -> event.getEventType() == CircuitBreakerEvent.Type.valueOf(eventType.toUpperCase()));
            Function<CircuitBreakerEvent, String> data = c -> Jackson.getObjectWriter(chain1.getRegistry()).writeValueAsString(CircuitBreakerEventDTOFactory.createCircuitBreakerEventDTO(c));
            ServerSentEvents events = ServerSentEvents.serverSentEvents(eventStream, e -> e.id(CircuitBreakerEvent::getCircuitBreakerName).event(c -> c.getEventType().name()).data(data));
            ctx.render(events);
        });
    });
}
Also used : Function(ratpack.func.Function) RxJava2Adapter(io.github.resilience4j.adapter.RxJava2Adapter) CircuitBreaker(io.github.resilience4j.circuitbreaker.CircuitBreaker) Promise(ratpack.exec.Promise) CircuitBreakerRegistry(io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry) Resilience4jConfig(io.github.resilience4j.ratpack.Resilience4jConfig) Jackson(ratpack.jackson.Jackson) ServerSentEvents(ratpack.sse.ServerSentEvents) Chain(ratpack.handling.Chain) Inject(javax.inject.Inject) Flowable(io.reactivex.Flowable) CircularEventConsumer(io.github.resilience4j.consumer.CircularEventConsumer) Action(ratpack.func.Action) Seq(io.vavr.collection.Seq) Comparator(java.util.Comparator) CircuitBreakerEvent(io.github.resilience4j.circuitbreaker.event.CircuitBreakerEvent) EventConsumerRegistry(io.github.resilience4j.consumer.EventConsumerRegistry) CircuitBreaker(io.github.resilience4j.circuitbreaker.CircuitBreaker) Resilience4jConfig(io.github.resilience4j.ratpack.Resilience4jConfig) CircuitBreakerEvent(io.github.resilience4j.circuitbreaker.event.CircuitBreakerEvent) CircularEventConsumer(io.github.resilience4j.consumer.CircularEventConsumer) ServerSentEvents(ratpack.sse.ServerSentEvents) Flowable(io.reactivex.Flowable)

Example 60 with Flowable

use of io.reactivex.Flowable in project resilience4j by resilience4j.

the class BulkheadMethodInterceptor method invoke.

@SuppressWarnings("unchecked")
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    Bulkhead annotation = invocation.getMethod().getAnnotation(Bulkhead.class);
    RecoveryFunction<?> recoveryFunction = annotation.recovery().newInstance();
    if (registry == null) {
        registry = BulkheadRegistry.ofDefaults();
    }
    io.github.resilience4j.bulkhead.Bulkhead bulkhead = registry.bulkhead(annotation.name());
    if (bulkhead == null) {
        return invocation.proceed();
    }
    Class<?> returnType = invocation.getMethod().getReturnType();
    if (Promise.class.isAssignableFrom(returnType)) {
        Promise<?> result = (Promise<?>) invocation.proceed();
        if (result != null) {
            BulkheadTransformer transformer = BulkheadTransformer.of(bulkhead).recover(recoveryFunction);
            result = result.transform(transformer);
        }
        return result;
    } else if (Observable.class.isAssignableFrom(returnType)) {
        Observable<?> result = (Observable<?>) invocation.proceed();
        if (result != null) {
            BulkheadOperator operator = BulkheadOperator.of(bulkhead);
            result = result.lift(operator).onErrorReturn(t -> recoveryFunction.apply((Throwable) t));
        }
        return result;
    } else if (Flowable.class.isAssignableFrom(returnType)) {
        Flowable<?> result = (Flowable<?>) invocation.proceed();
        if (result != null) {
            BulkheadOperator operator = BulkheadOperator.of(bulkhead);
            result = result.lift(operator).onErrorReturn(t -> recoveryFunction.apply((Throwable) t));
        }
        return result;
    } else if (Single.class.isAssignableFrom(returnType)) {
        Single<?> result = (Single<?>) invocation.proceed();
        if (result != null) {
            BulkheadOperator operator = BulkheadOperator.of(bulkhead);
            result = result.lift(operator).onErrorReturn(t -> recoveryFunction.apply((Throwable) t));
        }
        return result;
    } else if (CompletionStage.class.isAssignableFrom(returnType)) {
        if (bulkhead.isCallPermitted()) {
            return ((CompletionStage<?>) invocation.proceed()).handle((o, throwable) -> {
                bulkhead.onComplete();
                if (throwable != null) {
                    try {
                        return recoveryFunction.apply(throwable);
                    } catch (Exception e) {
                        throw Exceptions.uncheck(throwable);
                    }
                } else {
                    return o;
                }
            });
        } else {
            final CompletableFuture promise = new CompletableFuture<>();
            Throwable t = new BulkheadFullException(String.format("Bulkhead '%s' is full", bulkhead.getName()));
            try {
                promise.complete(recoveryFunction.apply(t));
            } catch (Throwable t2) {
                promise.completeExceptionally(t2);
            }
            return promise;
        }
    }
    return handleOther(invocation, bulkhead, recoveryFunction);
}
Also used : BulkheadRegistry(io.github.resilience4j.bulkhead.BulkheadRegistry) BulkheadFullException(io.github.resilience4j.bulkhead.BulkheadFullException) Inject(com.google.inject.Inject) Promise(ratpack.exec.Promise) CompletableFuture(java.util.concurrent.CompletableFuture) Single(io.reactivex.Single) BulkheadOperator(io.github.resilience4j.bulkhead.operator.BulkheadOperator) RecoveryFunction(io.github.resilience4j.ratpack.recovery.RecoveryFunction) MethodInterceptor(org.aopalliance.intercept.MethodInterceptor) MethodInvocation(org.aopalliance.intercept.MethodInvocation) CompletionStage(java.util.concurrent.CompletionStage) Flowable(io.reactivex.Flowable) Exceptions(ratpack.util.Exceptions) Observable(io.reactivex.Observable) BulkheadOperator(io.github.resilience4j.bulkhead.operator.BulkheadOperator) Observable(io.reactivex.Observable) BulkheadFullException(io.github.resilience4j.bulkhead.BulkheadFullException) Promise(ratpack.exec.Promise) CompletableFuture(java.util.concurrent.CompletableFuture) Single(io.reactivex.Single) BulkheadFullException(io.github.resilience4j.bulkhead.BulkheadFullException) CompletionStage(java.util.concurrent.CompletionStage) Flowable(io.reactivex.Flowable)

Aggregations

Flowable (io.reactivex.Flowable)65 Test (org.junit.Test)29 List (java.util.List)21 TimeUnit (java.util.concurrent.TimeUnit)19 Observable (io.reactivex.Observable)14 TestSubscriber (io.reactivex.subscribers.TestSubscriber)14 Assert.assertTrue (org.junit.Assert.assertTrue)14 JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)13 Single (io.reactivex.Single)13 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)13 ClientBuilder (javax.ws.rs.client.ClientBuilder)13 MediaType (javax.ws.rs.core.MediaType)13 AbstractResourceInfo (org.apache.cxf.jaxrs.model.AbstractResourceInfo)13 FlowableRxInvoker (org.apache.cxf.jaxrs.rx2.client.FlowableRxInvoker)13 FlowableRxInvokerProvider (org.apache.cxf.jaxrs.rx2.client.FlowableRxInvokerProvider)13 AbstractBusClientServerTestBase (org.apache.cxf.testutil.common.AbstractBusClientServerTestBase)13 BeforeClass (org.junit.BeforeClass)13 Collections (java.util.Collections)9 Response (javax.ws.rs.core.Response)9 Assert.assertEquals (org.junit.Assert.assertEquals)9