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

Improve documentation on Batch - Task integration, especially regarding datasource and transactionManagers #945

Open
nightswimmings opened this issue Jan 22, 2024 · 0 comments

Comments

@nightswimmings
Copy link

nightswimmings commented Jan 22, 2024

Despite this and this, the outdated samples and the newer samples (later one seems to pass green because for some reason SimpleTaskAutoConfiguration is configuring the beans after JobConfiguration injections), I can't find a clear documentation on how we should combine Spring Batch and Spring Task at low level, which seems to be the scenario for the majority of user base, considering the issues section.

  • Is desirable that both Batch (BatchAutoconfiguration) and Task (SimpleTasAutoconfiguration) reuse same datasource and transactionmanager?
  • If no, which one should we use in JobConfiguration new API, that requires to pass transactionManager to create a tasklet or a chunklet?
  • If yes, why is DefaultTaskConfigurer creating a TransactionManager from the @primary datasource regardless any potential @primary transactionManager
  • Shouldn't the samples as defined right now fail on duplicate bean in JobConfiguration when trying to inject the @primary transactionManager? In an scenario where defaults are provided, both DatasourceTransactionManager and SimpleTaskAutconfiguration expose a PlatformTransactionManager

The scenario gets even more tricky if the domain/logical part of the task also uses a database connection, so we need yet another datasource.

Thanks for all your amazing work so far, mates!!

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

1 participant