从EventBus @ConsumeEvent调用时,Quarkus Panache存储库调用静默失败

问题描述

Quarkus 1.8.3.Final

直接调用访问PanacheRepository的方法可以正常工作,但是当通过EventBus调用同一方法时,该调用到达该方法并执行每一行,直到到达任何存储库调用,然后静默失败/退出没有任何迹象表明发生了什么。

根据日志,直接调用在Quarkus主线程中执行,而事件总线调用在vert.x-eventloop-thread-2中执行。

还尝试了以下步骤的组合,结果相同:

  • 将EventBus的消费者方包装到Mutiny Uni。
  • 让消费者退货。
  • 让消费者明确阻止= false(默认值)。
  • 尝试同时实现 io.vertx.core.eventbus.EventBus io.vertx.mutiny.core.eventbus.EventBus 实现。
  • 将消费者置于相同和不同的服务中。
  • 在调用的方法上带有@Transactional批注。
@ApplicationScoped
public class TestEntityRepository implements PanacheRepository<TestEntity> { }
@Slf4j
@Startup
@Transactional
@ApplicationScoped
public class TestService {

    @Inject
    TestEntityRepository repository;

    @Inject
    EventBus eventBus;

    public void startUp(@Observes StartupEvent event) {
        // Call via the event bus prints the log in listEntities() and silently stops when it reaches the repository call.
        eventBus.sendAndForget("test_topic","eventbus call");
        // This  prints the log in listEntities() and then lists all the entities in the repository.
        listEntities("direct call");
    }

    @ConsumeEvent("test_topic")
    public void listEntities(String testMessage) {
        log.info("Printing all entities via: " + testMessage);
        repository.findAll().stream().map(TestEntity::toString).forEach(log::info);
    }

以下是日志的EventBus部分的摘录:

2020-10-19 21:24:39,612 INFO  [org.acm.com.TestService] (vert.x-eventloop-thread-1) Printing all entities via: eventbus call
2020-10-19 21:24:39,617 TRACE [com.arj.ats.jta] (vert.x-eventloop-thread-1) TransactionImple.setRollbackOnly
2020-10-19 21:24:39,617 TRACE [com.arj.ats.arjuna] (vert.x-eventloop-thread-1) BasicAction::preventCommit( BasicAction: 0:ffff7f000101:a721:5f8de7f7:0 status: ActionStatus.RUNNING)
2020-10-19 21:24:39,617 TRACE [com.arj.ats.jta] (vert.x-eventloop-thread-1) TransactionImple.getStatus: javax.transaction.Status.STATUS_MARKED_ROLLBACK
2020-10-19 21:24:39,618 TRACE [com.arj.ats.jta] (vert.x-eventloop-thread-1) BaseTransaction.rollback
2020-10-19 21:24:39,618 TRACE [com.arj.ats.jta] (vert.x-eventloop-thread-1) TransactionImple.rollbackAndDisassociate
2020-10-19 21:24:39,618 TRACE [com.arj.ats.arjuna] (vert.x-eventloop-thread-1) BasicAction::Abort() for action-id 0:ffff7f000101:a721:5f8de7f7:0
2020-10-19 21:24:39,618 TRACE [com.arj.ats.arjuna] (vert.x-eventloop-thread-1) BasicAction::removeChildThread () action 0:ffff7f000101:a721:5f8de7f7:0 removing 1
2020-10-19 21:24:39,618 TRACE [com.arj.ats.arjuna] (vert.x-eventloop-thread-1) BasicAction::removeChildThread () action 0:ffff7f000101:a721:5f8de7f7:0 removing 1 result = true
2020-10-19 21:24:39,618 TRACE [com.arj.ats.arjuna] (vert.x-eventloop-thread-1) TransactionReaper::remove ( BasicAction: 0:ffff7f000101:a721:5f8de7f7:0 status: ActionStatus.ABORTED )

更新bugreport created

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)