Skip to content

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

Open
@nightswimmings

Description

@nightswimmings

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!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions