作业存储库和Spring Batch编写者的单独数据源 [英] Seperate datasource for jobrepository and writer of Spring Batch

查看:135
本文介绍了作业存储库和Spring Batch编写者的单独数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Job是简单的CSVtoDBFileWriter:

Job is simple CSVtoDBFileWriter :

  1. 从oracle1读取CSV文件名和位置
  2. 读取CSV文件(批处理读取器)
  3. 在表(oracle2)中写入(批处理写入器)

我有2个数据源:

  • Oracle1

      : available when application context loads and 
      : I read properties from Oracle1's tables to create oracle2
      : jobRepository related tables should be stored here(oracle1)

  • Oracle2 :Spring批处理程序的最终输出目的地数据库.

  • Oracle2 : Destination database where Spring batch's writer will finally output.

    问题1:我需要XA transactionManager吗?

    Question1 : Do I need XA transactionManager?

    问题2:我只能在使用Spring Boot的情况下在生产中运行此应用程序,在生产中使用Spring Boot会有挑战吗?

    Question2 : Can I run this application in production only using Spring Boot, are there challanges with Spring Boot in production?

    推荐答案

    仅当SB元数据表存储在与用于数据写入的数据库不同的数据库中时,才需要XA事务.因为必须存储检查点(数据和SB元数据)同时照顾到同步性和可重启性.
    可以从其他数据源进行读取而不会出现问题,因为读取与SB元数据的保存位置无关.

    You only need XA transaction when SB metadata tables are stored in a different database than the one using for data writing because checkpoint (data and SB metadata) must be stored at the same time to take care of synchronization and restartability.
    Reading can be done from a different datasource without problems because reading is unrelated respect to where SB metadata are saved.

    这篇关于作业存储库和Spring Batch编写者的单独数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆