1

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.

user1637487
  • 241
  • 1
  • 9
  • 17
  • If your application consists in loading a huge amount of data in batches and then stop, then you probably don't need reactive. You can do with reactive of course, but I doubt you get any benefit in this use case. In fact, as you noticed, you must wait for the completion event before letting the application stop. Can you update the question to explain why you wanted to use the reactive model? – tsegismont Apr 08 '22 at 07:31
  • @tsegismont Apologies for my delay in the response. What I have noticed is using batch reactive fire and forget instead of sync inserts the batch job completes in half a time. Hence trying to use the reactive model. Also one more thing I have noticed is, suppose I have n batches (number of records/batch size) if I triggered executeBatchAndForget() for n batches and only trigger executeBatchAndAwait() for the remainder, the application seems to be waiting for all the transactions to complete. Updating the question with this finding. – user1637487 Apr 20 '22 at 11:58

0 Answers0