如何指示 QuarkusApplication 等待反应式 vertx MySQLPool 完成executeBatchAndForget 语句的执行?

发布于 2025-01-19 21:39:47 字数 774 浏览 3 评论 0原文

我们需要将大型文件加载到MySQL DB。我已经写了一个简单的quarkusapplication quarkus-ractive-mysql-client以执行executeBatchandForget以将记录导入到数据库中。我看到以下错误,这表明主应用程序已经停止,因此池已关闭。

错误[io.qua.mut.run.mutinyinfrastructure](vert.x-eventloop-thread-0)utiny必须删除以下例外:io.vertx.core.impl.impl.nostacktractractractracthrowable:pool loce offer pool pool

我可以使用executeBatchandawait哪种消除了应用程序的反应性,因此避免了它。

有没有办法阻止主应用程序关闭,直到MySQLPool完成处理?

更新

我尝试了一个工作。例如,说明我有n批次(记录数/批量大小),如果我为n记录运行executeBatchandForget(),然后运行executebatchandawait()< /代码>对于剩余,该应用程序似乎正在等待完成所有插入。如果没有余数,executeandawait() select语句似乎也有效。

We have a requirement to load a huge file to MySQL DB. I have written a simple QuarkusApplication with quarkus-reactive-mysql-client to execute a executeBatchAndForget to batch import the records into the DB. I see the below error, which suggests that the Main application has stopped, and hence the pool is closed.

ERROR [io.qua.mut.run.MutinyInfrastructure] (vert.x-eventloop-thread-0) Mutiny had to drop the following exception: io.vertx.core.impl.NoStackTraceThrowable: Pool closed

I could use executeBatchAndAwait which kind of eliminates the reactive nature of the application, hence avoiding it.

Is there a way to stop the Main application from closing until the MySqlpool finishes the processing?

Update

I have tried a work-around. Say for example if I have n batches (number of records / batch size) and if I run executeBatchAndForget() for n records and then run executeBatchAndAwait() for the remainder, the application seems to be waiting to complete all inserts. In case of no remainder, an executeAndAwait() of SELECT statement also seems to work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文