简体   繁体   English

为什么 Quarkus/Smalrye 消息传递消费者会在阻塞的 vertx 线程上运行?

[英]Why would Quarkus/Smalrye messaging consumer nack on on blocked vertx thread?

I though this message was for warning, so why would the consumer nack it?我虽然这条消息是为了警告,那消费者为什么不接受呢? Also adding @Blocking to the process function below seems to "fix" the issue.还将@Blocking 添加到下面的流程功能似乎可以“解决”该问题。

I have my processor like so...我的处理器是这​​样的...

@Incoming("topic-in")
public void process(String event) {
    // This call Http rest Clients underneath 
    someService.update(event);
}
java.lang.IllegalStateException: The current thread cannot be blocked: vert.x-eventloop-thread-0
    at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:30)
    at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:65)
    at io.smallrye.mutiny.groups.UniAwait.indefinitely(UniAwait.java:46)
    at io.quarkus.cache.runtime.CacheResultInterceptor.intercept(CacheResultInterceptor.java:116)
    at io.quarkus.cache.runtime.CacheResultInterceptor_Bean.intercept(Unknown Source)
    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 xxxxxx.service.AuthService_Subclass.authenticate(Unknown Source)
    at xxxxxx.service.SomeService.update(SubscriberService.java:46)
    at xxxxxx.service.SomeService_Subclass.update$$superforward1(Unknown Source)
    at xxxxxx.service.SomeService_Subclass$$function$$3.apply(Unknown Source)
    at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
    at io.smallrye.faulttolerance.FaultToleranceInterceptor.lambda$syncFlow$3(FaultToleranceInterceptor.java:253)
    at io.smallrye.faulttolerance.core.InvocationContext.call(InvocationContext.java:20)
    at io.smallrye.faulttolerance.core.Invocation.apply(Invocation.java:29)
    at io.smallrye.faulttolerance.core.retry.Retry.doApply(Retry.java:88)
    at io.smallrye.faulttolerance.core.retry.Retry.apply(Retry.java:42)
    at io.smallrye.faulttolerance.FaultToleranceInterceptor.syncFlow(FaultToleranceInterceptor.java:255)
    at io.smallrye.faulttolerance.FaultToleranceInterceptor.intercept(FaultToleranceInterceptor.java:182)
    at io.smallrye.faulttolerance.FaultToleranceInterceptor_Bean.intercept(Unknown Source)
    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 xxxxxx.service.SubscriberService_Subclass.update(Unknown Source)
    at xxxxxx.messaging.MyProcessor.updateCustomer(CustomerProcessor.java:6262)
    at xxxxxx.messaging.MyProcessor.update(CustomerProcessor.java:6204)
    at xxxxxx.messaging.MyProcessor.process(CustomerProcessor.java:6162)
    at xxxxxx.messaging.MyProcessor_ClientProxy.process(Unknown Source)
    at xxxxxx.messaging.MyProcessor_SmallRyeMessagingInvoker_process_bd386abe989418e778612ad8212523c81d813d5e.invoke(Unknown Source)
    at io.smallrye.reactive.messaging.providers.AbstractMediator.invoke(AbstractMediator.java:95)
    at io.smallrye.reactive.messaging.providers.AbstractMediator.lambda$invokeOnMessageContext$1(AbstractMediator.java:103)
    at io.smallrye.reactive.messaging.providers.locals.LocalContextMetadata.lambda$invokeOnMessageContext$0(LocalContextMetadata.java:34)
    at io.smallrye.reactive.messaging.providers.locals.LocalContextMetadata.lambda$invokeOnMessageContext$2(LocalContextMetadata.java:55)
    at io.smallrye.context.impl.wrappers.SlowContextualConsumer.accept(SlowContextualConsumer.java:21)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateWithEmitter.subscribe(UniCreateWithEmitter.java:22)
    at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
    at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap.subscribe(UniOnItemOrFailureFlatMap.java:27)
    at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
    at io.smallrye.mutiny.converters.uni.UniToMultiPublisher$UniToMultiSubscription.request(UniToMultiPublisher.java:74)
    at io.smallrye.mutiny.operators.multi.MultiFlatMapOp$FlatMapInner.onSubscribe(MultiFlatMapOp.java:601)
    at io.smallrye.mutiny.converters.uni.UniToMultiPublisher.subscribe(UniToMultiPublisher.java:26)
    at io.smallrye.mutiny.groups.MultiCreate$1.subscribe(MultiCreate.java:163)
    at io.smallrye.mutiny.operators.multi.MultiFlatMapOp$FlatMapMainSubscriber.onItem(MultiFlatMapOp.java:193)
    at io.smallrye.mutiny.operators.multi.MultiMapOp$MapProcessor.onItem(MultiMapOp.java:50)
    at io.smallrye.mutiny.subscription.MultiSubscriber.onNext(MultiSubscriber.java:61)
    at io.smallrye.mutiny.subscription.SafeSubscriber.onNext(SafeSubscriber.java:99)
    at io.smallrye.mutiny.helpers.HalfSerializer.onNext(HalfSerializer.java:31)
    at io.smallrye.mutiny.helpers.StrictMultiSubscriber.onItem(StrictMultiSubscriber.java:85)
    at io.smallrye.mutiny.operators.multi.MultiOperatorProcessor.onItem(MultiOperatorProcessor.java:100)
    at io.smallrye.reactive.messaging.providers.locals.ContextDecorator$ContextMulti$ContextProcessor.lambda$onItem$1(ContextDecorator.java:78)
    at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100)
    at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:63)
    at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:38)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:829)

@Blocking seems to fix in your case because it indicates to quarkus that this operation is blocking, it makes quarkus happy. @Blocking似乎可以解决您的问题,因为它向 quarkus 表明此操作正在阻塞,它使 quarkus 高兴。 But when you don't put it, and still do a blocking operation, quarkus complains.但是当你不放它,仍然进行阻塞操作时,quarkus 会抱怨。

I believe your http rest endpoint call is not reactive, that's why quarkus complains.我相信您的 http rest 端点调用没有反应,这就是 quarkus 抱怨的原因。 Try replacing it by any reactive operation and try again.尝试用任何反应操作替换它,然后重试。

If it's working, your solution simply is to use reactive http client to make your calls.如果它工作正常,您的解决方案就是使用响应式 http 客户端来拨打电话。

Check quarkus http reactive rest client documentation检查 quarkus http 反应式休息客户端文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Quarkus 升级抱怨测试中的 vertx 线程 - Quarkus upgrade complaining regarding vertx thread in tests 在 QUARKUS 中将 Reactive RestEasy 与 GraphQlClient 一起使用时出现线程阻塞问题 - Thread Blocked Problem when using Reactive RestEasy with GraphQlClient in QUARKUS @Inject 不适用于 Quarkus + Vertx + Kotlin - @Inject not working on Quarkus + Vertx + Kotlin 在 quarkus vertx 反应式中记录 id - logging id in quarkus vertx reactive 为什么 Cassandra Quarkus 扩展不使用 smallrye-mutiny-vertx-cassandra-client 与 Cassandra 交互? - Why does Cassandra Quarkus extension not use smallrye-mutiny-vertx-cassandra-client to interact with Cassandra? Vertx 在 Quarkus vertx munity web 客户端扩展中不可用 - Vertx is not available in Quarkus vertx munity web client extesions quarkus:被 CORS 策略阻止 - quarkus: blocked by CORS policy 如何使用vertx和quarkus发布静态集合 - How to publish static collection with vertx and quarkus 在 Quarkus 中配置集群 Vertx Eventbus 的问题 - Problems configuring clustered Vertx Eventbus in Quarkus 在 Quarkus 反应代码中响应 NACK 消息导致就绪检查失败 - Responding NACK on message in Quarkus reactive code cause the readiness check to fail
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM