Search in sources :

Example 26 with Subscriber

use of org.reactivestreams.Subscriber in project camel by apache.

the class EventTypeTest method testOnErrorHeaderNotForwarded.

@Test
public void testOnErrorHeaderNotForwarded() throws Exception {
    new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from("reactive-streams:numbers").to("mock:endpoint");
        }
    }.addRoutesToCamelContext(context);
    Subscriber<Integer> numbers = CamelReactiveStreams.get(context).streamSubscriber("numbers", Integer.class);
    context.start();
    RuntimeException ex = new RuntimeException("1");
    Flowable.just(1).map(n -> {
        if (n == 1) {
            throw ex;
        }
        return n;
    }).subscribe(numbers);
    MockEndpoint endpoint = getMockEndpoint("mock:endpoint");
    endpoint.expectedMessageCount(0);
    endpoint.assertIsSatisfied(200);
}
Also used : CamelReactiveStreams(org.apache.camel.component.reactive.streams.api.CamelReactiveStreams) Flowable(io.reactivex.Flowable) RouteBuilder(org.apache.camel.builder.RouteBuilder) Exchange(org.apache.camel.Exchange) Test(org.junit.Test) CamelTestSupport(org.apache.camel.test.junit4.CamelTestSupport) Subscriber(org.reactivestreams.Subscriber) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) RouteBuilder(org.apache.camel.builder.RouteBuilder) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Aggregations

Subscriber (org.reactivestreams.Subscriber)26 Subscription (org.reactivestreams.Subscription)16 Publisher (org.reactivestreams.Publisher)8 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 Test (org.junit.Test)5 ByteBuf (io.netty.buffer.ByteBuf)4 BooleanSubscription (io.reactivex.internal.subscriptions.BooleanSubscription)4 TestSubscriber (io.reactivex.subscribers.TestSubscriber)3 InetSocketAddress (java.net.InetSocketAddress)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 Exchange (org.apache.camel.Exchange)3 Test (org.testng.annotations.Test)3 TransformablePublisher (ratpack.stream.TransformablePublisher)3 ReactiveSubscription (reactor.rx.subscription.ReactiveSubscription)3 Flowable (io.reactivex.Flowable)2 TestException (io.reactivex.exceptions.TestException)2 ExecutorService (java.util.concurrent.ExecutorService)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2 RouteBuilder (org.apache.camel.builder.RouteBuilder)2