首页 \ 问答 \ 微服务架构(Microservice architecture)

微服务架构(Microservice architecture)

我们有多个用Java,C#,nodeJS和python编写的独立应用程序。 所有这些应用程序共享一个共同属性 - 它们使用REST API基于每个客户的计划从某些源提取数据并将其存储在CSV文件中,稍后使用存储过程将数据从CSV文件导入到不同的SQL数据库。 每个应用程序用于集成来自不同第三方服务的数据。

例如 - app A从源A'获取数据,app B从源B获取数据'

我正在考虑通过编写一个可以处理来自不同来源的数据的多租户单个应用程序来替换这些多个独立的应用程序。 所有这些单独的小应用程序将配置为用Java编写的自定义作业。 例如 - REST API身份验证,在创建CSV之前预处理数据等。

所以,我想编写一个从源A'获取数据的作业(Java文件)和从源B'获取数据的另一个作业。 主应用程序将执行此自定义作业。 主应用程序将支持诸如作业调度,日志记录等常用功能。

后来我打算用nifi处理从CSV到SQL数据库的数据导入。

这会是一个好方法吗? 我打算用Java编写这个应用程序。

解决方案背后的原因

  • 多个代码库来维护
  • 在提取数据时没有并发性
  • 所有这些应用程序都作为单个实例部署

如果我需要更新一个作业,我需要部署整个应用程序。 如何绕过这个过程? 有什么方法可以部署工作而不是整个应用程序?

构建此解决方案的好方法是什么?


We have multiple separate applications written in Java,C#,nodeJS and python. All these application share a common property - they pull data from some source based on schedule per customer basis using REST API and store it in CSV file, later import data from CSV file to different SQL database using stored procs. Each application is used to integrate data from different third party service.

For example - app A fetching data from source A' and app B fetching data from source B'

I'm thinking of replacing these multiple separate applications by writing one multi-tenant single application which can handle pulling data from different sources. All these separate small applications will be configured as a custom job written in Java. For example - REST API authentication, pre-processing of data before creating CSV etc.

So, I want to write a job (Java file) that fetches data from source A' and another job that fetches data from source B'. The main application will execute this custom job. The common functionality such as job scheduling, logging etc will be supported by the main application.

Later I intend to use nifi to handle data import from CSV to SQL database.

Will this be a good approach? I'm planning to write this application in Java.

Reason behind the solution

  • Multiple code base to maintain
  • No concurrency in pulling data
  • All these applications are deployed as a single instance

If I need to update one job I need to deploy the whole application. How to get around this process? Is there any way I can deploy just the job and not the whole application?

What would be the good way to architect this solution?


原文:https://stackoverflow.com/questions/45203055
更新时间:2022-06-25 14:06

最满意答案

由于constructorcomponentWillMount仅在安装到DOM树中的每个组件运行一次,因此不会在传递的每个props上更新状态。

this.state对于每个组件实例都是本地的,需要使用this.setState()进行更新,以便能够在每个渲染过程中使用更新的状态对象。

使用componentWillReceiveProps ,您可以在其中设置状态以反映传入的新prop,以便获得所需内容。


Since the constructor and componentWillMount is only run once per component mounted in to the DOM tree the state wouldn't be updated on each props being passed down.

this.state is local for each component instance and needs to be updated with this.setState() to be able to use an updated state object on each render pass.

Use componentWillReceiveProps in which you can set the state to reflect the new prop being passed in for you to get what you need.

相关问答

更多
  • 由于constructor和componentWillMount仅在安装到DOM树中的每个组件运行一次,因此不会在传递的每个props上更新状态。 this.state对于每个组件实例都是本地的,需要使用this.setState()进行更新,以便能够在每个渲染过程中使用更新的状态对象。 使用componentWillReceiveProps ,您可以在其中设置状态以反映传入的新prop,以便获得所需内容。 Since the constructor and componentWillMount is on ...
  • 问题在componentWillReceiveProps : this.setState({ details: nextProps }); 它应该是 : this.setState({ details: nextProps.details }); 并删除this.forceUpdate(); ,这里不需要forceUpdate 。 Sultion to second issue将defaultValue更改为value :
  • 如果我理解正确,你有一个父组件将start_time传递给ModalBody组件,它将它分配给自己的状态 而且您希望从父级更新该时间,而不是子组件。 反应有一些处理这种情况的提示。 使用道具在getInitialState生成状态通常会导致“真实来源”的重复,即实际数据的位置。 这是因为仅当组件首次创建时才调用getInitialState 。 只要有可能,即时计算值,以确保它们不会在以后不再同步,并导致维护问题。 基本上,每当你将父母的props分配给一个孩子的state ,渲染方法并不总是在支持更新中被 ...
  • componentWillReceiveProps接收下一个道具作为第一个参数,所以通过记录this.state.props你会看到当前的道具,而不是正在接收的道具。 尝试记录下面这样的内容: componentWillReceiveProps(nextProps){ console.log(nextProps.data); } 当然,您也可以通过调用componentDidUpdate生命周期方法而不是(或者如果要同时监视这两个步骤) componentWillReceiveProps来检查更新 ...
  • 发生了什么 虽然您将this.updateThing传递给 ,但是当update 时调用此函数时,上下文发生更改,导致undefined this.getThings() 怎么修 当在ChildForm中调用该函数时,使用bind来替换这个。 MDN报价: bind()方法创建一个新的函数,该函数在调用时将其关键字设置为提供的值,并在调用新函数时提供的任何前面给定的参数序列。 因此,尝试用update={this.updateThing.bind(this ...
  • 正如上面的评论中所指出的,有许多方法可以在组件之间传递数据。 http://andrewhfarmer.com/component-communication/ 关于回调的文章是我的解决方案。 As pointed out in the comments above there is a number of ways to pass data between components. http://andrewhfarmer.com/component-communication/ Following the ...
  • 您需要在将商店传递给商店之前为其添加水分,然后向商家提供初始状态,这样当您的应用“启动”时,您的商店就已经拥有了可用的数据。 使用connect是正确的方法。 如果您正在运行服务器端呈现的应用程序,您可以在第一次请求时将您的json内容放在附加到window的属性中,然后在存储已经水合后将其清空。 沿window.__BOOTSTRAP__线的东西window.__BOOTSTRAP__ 。 store = createStore(appReducers, { content: yourJsonFileCo ...
  • 看起来有几个jQuery插件正在直接编辑DOM,这会引发反响。 看起来你正在使用jQuery UI,编辑DOM非常自由......如果可能的话,使用为ReactJs设计的插件。 对于初学者,请尝试替换以下内容: jQuery下拉列表: https : //github.com/JedWatson/react-select jQuery模式: https : //github.com/reactjs/react-modal 另外,看一下react-bootstrap: http : //react-boots ...
  • 由于您在两个组件MainTool和AdditionalInfoBlock上处理相同的状态,因此查找注释的值可能会令人困惑。 当您正在侦听注释更改时,您将在两个组件上设置状态。 父组件MainTool更改的状态是将props传递给子AdditionalInfoBlock 。 getInitialState在mounting之前调用一次( getInitialState文档 )。 因此,对于后续更新,您的子组件不会处理传递的属性。 通过使用componentWillReceiveProps ,您将能够处理Mai ...
  • 您将cartNumber作为布尔值传递:
    将其作为值传递给它:
    You're passing cartNumber as a boolean:

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)