-
Notifications
You must be signed in to change notification settings - Fork 51
Add support for multiple datasources and transactionManagers in Spring #959
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
base: master
Are you sure you want to change the base?
Conversation
…so that it can be used in multi tx/ds setups
…essor so that retries work
…e my opinion on codebase
...box-spring/src/main/java/com/gruelbox/transactionoutbox/spring/SpringTransactionManager.java
Outdated
Show resolved
Hide resolved
|
@badgerwithagun somehting like this? I have not used the throws E pattern before so I am a bit baffled about it =) But I do have a semi guilty conscience about how I implemented it, was so happy to re-use the existing mechanism but dont know the macro perspective. |
|
Or even better, reuse the class you have provided |
|
Just ran mvn com.spotify.fmt:fmt-maven-plugin:format Didnt notice it was in place until now. Was only building inside the spring module as the oracle image fails to run for me on arm, it outputs warnings about being slow and then after quite some time it timeouts.. |
|
@badgerwithagun any chance moving this forward? Not super critical, have my own copy of this class as a workaround for now but would be nice to remove need for custom class =) |
|
Hey @nilo85 - I'm not certain about the casting either. Seems brittle to me! I think we need to start with a suitable test. You need to add something to the existing full-stack test in the Spring module which does this sort of thing: schedule two pieces of work with the same unique id and confirm that the second throws I suggest testing this first with your fix reversed. |
…ionReturnsThrows executes transaction as expected and preserves various exceptions that are thrown
|
Thanks for your feedback! I added a bit of coverage for the SpringTransactionManager regarding how it handles exceptions, maybe this is enough already.. Will try to think about where it makes sense to put such an integration test you mentioned and see if I can run the test on initial code vs new code somehow. |
|
@badgerwithagun I get the following exception both before and after my changes: Not sure if I am doing something wrong, or expectation of getting AlreadyScheduledException is wrong? |
|
THe test in nilo85@9676663 looks good, and you appear to have uncovered an existing issue! Just having a look now... |
|
I think the issue is in SpringTransactionManager$BatchCountingStatementHandler.invoke; it needs to unwrap |
I think |
|
@badgerwithagun I applied the fix in a separate pr #977 |
The
@Transactionalannotation in SpringTransactionManager is not compatible with multiple transaction managers, as it tries to force the default one. (Which probably does not even exist and it will complain about expecting one but got several)I have modified it so that it programatically runs transactions and made txManager and dataSource injectable.
Renamed the example test application to example.simple (it shows it still works with default txManager & dataSource)
I then also added a "copy" called example.multipledatasources showcasing how to use library with multi datasource setup.
Happy to address any concerns you see, kept the commits in some meaningful chunked unit, hopefully it helps reviewing, happy to rebase and squash if you prefer that =)