1 year ago
#388547
user1637487
How to instruct the QuarkusApplication to wait until the reactive vertx MySQLPool completes the execution of executeBatchAndForget statement?
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.
quarkus
vert.x
quarkus-panache
quarkus-reactive
0 Answers
Your Answer