可以我使用 Spring Batch 的写入器同时用于 HTTP POST 请求和写入数据库吗?

huangapple go评论63阅读模式
英文:

Can I use spring batch writer to for both HTTP post request and write to db

问题

我想从数据库中读取一系列记录,然后对其进行迭代,并针对每个记录执行以下操作:

  1. 解析生成 JSON 主体的数据,并发送 HTTP POST 请求。
  2. 根据上述 HTTP POST 的结果更新数据库。

我想使用 Spring-Batch 框架来管理多节点同步。是否可以使用这个框架?

英文:

I would like to read a list of records from DB, then iterate over it, and perform the following actions for each record:

  1. Resolve data for generating JSON body, and send HTTP post request.
  2. Update DB, according to the above HTTP post result.

I would like to use Spring-Batch framework on order to manage multi node sync.
Its it possible to use this framework ?

答案1

得分: 1

你可以使用CompositeItemWriter,其中包含两个委托项目写入器:一个用于发送POST请求,另一个用于更新数据库。

英文:

You can use a CompositeItemWriter with two delegate item writers: one that sends the post request, and the other updates the DB.

huangapple
  • 本文由 发表于 2020年9月10日 23:39:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/63833168.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定