本文介绍了我们可以有用于后台批处理的微服务架构吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我开发了一个Spring Batch应用程序,其中配置了3个作业.只需部署一个jar即可执行三个3作业.

Recently i developed a spring batch application which has 3 jobs configured in it. Only one jar needs to be deployed to perform three 3 jobs.

如果有其他业务需求,我很乐意在现有配置中添加一个新作业,它将很好地工作.我们不会为此作业创建单独的jar.

If we get another business requirement , I would happily add a new job in existing configuration and it will work fine. We will not create a separate jar for this job.

我正在阅读一些微服务教程.我注意到我们为每个微服务创建了单独的代码存储库.在春季批处理中,我们将所有作业添加到一个罐中,尽管它们是像小型微服务这样的独立作业.

I was going through some micro service tutorials. I noticed that we create separate code repository for each micro service. In spring batch we add all jobs in one jar only though they are independent jobs like small micro services.

我的问题是,我们是否应该为后台批处理提供微服务类型的体系结构或代码存储库?如果是,我们是否必须为每个作业创建单独的存储库?如果不是,那为什么呢?

My questions is , Should we have micro service kind of architecture or code repository for background batches as well? if yes , do we have to create separate repository per job ?If not then why ?

谢谢.

推荐答案

在单个jar中打包多个独立的作业首先与微服务方法相反.没有什么可以阻止您为所有作业提供单个代码存储库,但是由于以下原因,我不会将它们打包在单个jar中:

Packaging multiple independent jobs in a single jar goes against the micro-services approach in the first place. Nothing prevents you from having a single code repository for all jobs, but I would not package them in a single jar for the following reasons:

  • 独立的生命周期:如果您在一项工作中修好了一件大事,则无需重新部署包含所有其他(不受影响)工作的单个整体罐子
  • 版本控制:工作可能会以不同的速度发展.一个罐子包含不同版本的不同作业是不理想的
  • 占地面积小:在网络使用方面,部署一次小型jar来更新单个作业比每次转移一个胖jar更好,更高效.
  • 让一件事情做一件事情并且做好事的所有其他充分理由

这篇关于我们可以有用于后台批处理的微服务架构吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 16:48