1

I'm working on reactive messaging with Quarkus v2.3.0 and Kafka extension. I reproduced the ignore failure strategy example given on this blog post https://quarkus.io/blog/kafka-failure-strategy/#the-ignore-strategy

I tried to apply it on a precessor method (with @Incoming and @Outoging) using Message<> wrapper signature. But when an exception is thrown I get the following error and the stream stops definitely which is not the expected behaviour of the ignore failure strategy :

    [Exception 0] java.lang.IllegalArgumentException: I don't like movie with ' in their title: io.smallrye.reactive.messaging.kafka.IncomingKafkaRecord@4e76ab1c
    [Exception 1] io.smallrye.reactive.messaging.ProcessingException: SRMSG00103: Exception thrown when calling the method org.acme.MovieProcessor#consume
    at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.performInnerSubscription(UniOnItemOrFailureFlatMap.java:89)
    at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.onFailure(UniOnItemOrFailureFlatMap.java:65)
    at io.smallrye.mutiny.operators.uni.UniOperatorProcessor.onFailure(UniOperatorProcessor.java:44)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:40)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage$CompletionStageUniSubscription.forwardResult(UniCreateFromCompletionStage.java:63)
    ...
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:834)
    Suppressed: io.smallrye.reactive.messaging.ProcessingException: SRMSG00103: Exception thrown when calling the method org.acme.MovieProcessor#consume
        at io.smallrye.reactive.messaging.ProcessorMediator.handlePostInvocationWithMessage(ProcessorMediator.java:339)
        at io.smallrye.context.impl.wrappers.SlowContextualBiFunction.apply(SlowContextualBiFunction.java:21)
        at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.performInnerSubscription(UniOnItemOrFailureFlatMap.java:86)
        ... 91 more
    Caused by: java.lang.IllegalArgumentException: I don't like movie with ' in their title: io.smallrye.reactive.messaging.kafka.IncomingKafkaRecord@4e76ab1c
        at org.acme.MovieProcessor.consume(MovieProcessor.java:46)
        at org.acme.MovieProcessor_Subclass.consume$$superforward1(MovieProcessor_Subclass.zig:180)
        at org.acme.MovieProcessor_Subclass$$function$$3.apply(MovieProcessor_Subclass$$function$$3.zig:33)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:49)
        at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
        at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
        at org.acme.MovieProcessor_Subclass.consume(MovieProcessor_Subclass.zig:428)
        at org.acme.MovieProcessor_ClientProxy.consume(MovieProcessor_ClientProxy.zig:188)
        at org.acme.MovieProcessor_SmallRyeMessagingInvoker_consume_e1df8366ae8945053ea77ff7477c27c43c0fd3ba.invoke(MovieProcessor_SmallRyeMessagingInvoker_consume_e1df8366ae8945053ea77ff7477c27c43c0fd3ba.zig:48)
        at io.smallrye.reactive.messaging.AbstractMediator.invoke(AbstractMediator.java:94)
        at io.smallrye.reactive.messaging.ProcessorMediator.lambda$processMethodReturningIndividualMessageAndConsumingIndividualItem$11(ProcessorMediator.java:270)
        at io.smallrye.context.impl.wrappers.SlowContextualFunction.apply(SlowContextualFunction.java:21)
        at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:36)
        ... 88 more
    [CIRCULAR REFERENCE:java.lang.IllegalArgumentException: I don't like movie with ' in their title: io.smallrye.reactive.messaging.kafka.IncomingKafkaRecord@4e76ab1c]

Here is the processor method :

    @Incoming("movies")
    @Outgoing("next")
    public Message<String> consume(Message<String> movie) {

        LOGGER.infof("Receiving movie %s", movie);
        if (movie.getPayload().contains("'")) {
            throw new IllegalArgumentException("I don't like movie with ' in their title: " + movie);
        }
        if (movie.getPayload().contains(",")) {
            throw new IllegalArgumentException("I don't like movie with , in their title: " + movie);
        }
        return movie.withPayload(movie.getPayload());
    }

Same code is working with the payload signature :

@Incoming("movies")
@Outgoing("next")
public String consume(String movie) {...}

The exception is logged but error is ignored and the consumption from movie topic continues as expected.

What did I miss ? Why is the exception not ignored ?

Maxime
  • 191
  • 9

0 Answers0