Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase transaction timeout in Quarkus?

Tags:

quarkus

I have some configurations in my application.properties file:

...
quarkus.datasource.url=jdbc:postgresql://...:5432/....
quarkus.datasource.driver=org.postgresql.Driver
quarkus.datasource.username=user
quarkus.datasource.password=password
quarkus.hibernate-orm.database.generation=update
...

I have a scheduler with a @Transactional method that takes a long time to finish executing:

@ApplicationScoped
class MyScheduler {

...

    @Transactional
    @Scheduled(every = "7200s")
    open fun process() {

        ... my slow proccess goes here...
        entityManager.persist(myObject)

    }
}

And then, the transactional method receives a timeout error like that:

2019-06-24 20:11:59,874 WARN  [com.arj.ats.arjuna] (Transaction Reaper) ARJUNA012117: TransactionReaper::check timeout for TX 0:ffff0a000020:d58d:5cdad26e:81 in state  RUN

2019-06-24 20:12:47,198 WARN  [com.arj.ats.arjuna] (DefaultQuartzScheduler_Worker-3) ARJUNA012077: Abort called on already aborted atomic action 0:ffff0a000020:d58d:5cdad26e:81

Caused by: javax.transaction.RollbackException: ARJUNA016102: The transaction is not active! Uid is 0:ffff0a000020:d58d:5cdad26e:81

I believe that I must increase the timeout of my transacional method. But I dont know how I can do this.

Someone could help me, please?

Thanks!

like image 311
Renan Vaz Avatar asked Jun 25 '19 03:06

Renan Vaz


1 Answers

Seems that this has changed -> it is now possible to set the Transaction timeout:

https://quarkus.io/guides/transaction

You can configure the default transaction timeout, the timeout that applies to all transactions managed by the transaction manager, via the property:

quarkus.transaction-manager.default-transaction-timeout = 240s

-> specified as a duration (java.time.Duration format). Default is 60 sec

like image 70
max Avatar answered Sep 29 '22 05:09

max