Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change commitWhenAutocommitDisabled in spring-boot configuration. #351

Closed
3 tasks done
juvraniak opened this issue Jan 12, 2023 · 4 comments
Closed
3 tasks done

Comments

@juvraniak
Copy link

juvraniak commented Jan 12, 2023

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected Behavior

In spring boot app when i have auto-commit for db turned off.
I submit one time task.
task is saved in db and later executed per schedule.

Current Behavior

In spring boot app when i have auto-commit for db turned off.
I submit one time task.
task is not saved in db and later executed per schedule.
Reason is auto-commit is off and commitWhenAutocommitDisabled cannot be changed per any config prop but one has to create new Scheduler bean.


Context

  • DB-Scheduler Version :
  • Java Version : 17
  • Spring Boot (check for Yes) : - [x]
  • Database and Version : postgresql 11

So i have prepared PR that address this feature enhancement, please let me know if it is something that make sense to you or not, or i am missing something. Thank you in advance.

#350

@kagkarlsson
Copy link
Owner

If we enable this property for Spring Boot, and app is using Spring transactions, any calls using the SchedulerClient (such as schedule a one-time task) will result in the larger transaction getting committed. Any subsequent RuntimeException from within the transaction will not result in a full rollback as would normally happen. So this is a bit dangerous.
How are you committing other jdbc-interactions?
If you would wrap the call to the scheduler.schedule(<onetime-task ...>); in a Spring transaction, I think things would work as expected.

Thoughts?

@juvraniak
Copy link
Author

Yes it worked, i will close PR, and yea it make more sense to wrap it.

@kagkarlsson
Copy link
Owner

Good to hear!

@juvraniak
Copy link
Author

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants