简体   繁体   English

两个隔离系统之间的同步

[英]synchronisation between two isolated systems

Need help, some kind of architectural advice... What's the best way of synchronisation between two isolated systems? 需要帮助,一些架构建议...两个隔离的系统之间同步的最佳方法是什么?

One is a standard java environment and the other one is some legacy system without j2ee integration and no scheduling options. 一个是标准的Java环境,另一个是没有j2ee集成且没有调度选项的遗留系统。 The Legacy system has web a service exposed and all processing is started by a call from client (java app). 旧版系统公开了一项Web服务,并且所有处理都是通过客户端(Java应用程序)的调用开始的。 The Processing will be started with approximately 100 web service calls and it will take too long to finish so I can't wait in a thread that long. 处理将以大约100个Web服务调用开始,并且完成过程将花费太长时间,因此我不能在线程中等待那么长时间。

I was considering of using an approach where the client starts processing and expose another web service to wait for the legacy system processing. 我正在考虑使用一种方法,其中客户端开始处理并公开另一个Web服务以等待旧系统处理。 The legacy system would provide information by putting needed data in database (record ID or something like that). 遗留系统将通过将所需数据放入数据库(记录ID或类似名称)来提供信息。 That would be another 100 calls, as some kind of answer to init calls. 那将是另外100个调用,作为对init调用的某种应答。 Is this legitimate software architecture solution? 这是合法的软件体系结构解决方案吗?

Both systems are reading/writing to same database. 这两个系统都在读/写相同的数据库。 Is there any need for 2 webservices because of that? 因此需要2个Web服务吗? The Legacy system has no option of a scheduled start so I need to initiate it some way. 旧版系统没有计划启动的选项,因此我需要以某种方式启动它。

It's not very clear what you have and what you need. 尚不清楚您拥有什么和需要什么。 So, let me speculate a little. 所以,让我推测一下。

1) Legacy system gets 100 requests then process them as a batch all together. 1)旧版系统收到100个请求,然后一起处理它们。 New system needs all these 100 answers to continue create new requests. 新系统需要所有这100个答案才能继续创建新请求。 Based on this assumption legacy system doesn't answer with something on each individual request. 基于此假设,遗留系统不会在每个单独的请求中都回答问题。 So, since there is no answer provided then new system should continue to shoot new requests hundred by hundred. 因此,由于没有提供答案,因此新系统应继续按百分百提出新请求。 However if new system should not make 101 request when 1-st was no done in legacy then synchronization is required. 但是,如果在传统中未完成1st时新系统不应该发出101请求,则需要同步。 So new one should not wait but not start 101 till it knows 1-st is done. 因此,新的不应等待直到知道第一个完成后才开始101。 This should be point of the synchronization - not waiting for 101 but check that 1-st is done. 这应该是同步的要点-不等待101,而是检查1st是否完成。 It could be done in legacy or new system but that's the point of synchronization. 它可以在旧系统或新系统中完成,但这就是同步的重点。

Your description of the problem and solution fits the http://en.wikipedia.org/wiki/Reactor_pattern . 您对问题和解决方案的描述符合http://en.wikipedia.org/wiki/Reactor_pattern It's a very common approach and well suited. 这是一种非常常见的方法,非常适合。

A few legitimate question: 1) After you reach 100 (or whatever magic number) and you start processing the request batch, what will happen to new requests? 一些合法的问题:1)达到100(或任何魔数)并开始处理请求批处理之后,新请求将如何处理? refused? 拒绝? queued for the new "100" batch? 排队等待新的“ 100”批次? 2) Soooo. 2) the batch resolution is asynchronous.. you now have two option: Option A: expose a webservice on client that the legacy system will "contact" to "bounce back" the feedback on those 100 elaboration Option B: expose a webservice on legacy server, and the current system will "ping" every 5 minutes, only if there are elaborations awaiting feedback, to tentatively fetch feedback. 批处理解决方案是异步的。您现在有两个选择:选项A:在客户端上公开Web服务,旧系统将“联系”以“弹回”有关这100项详细说明的反馈。选项B:在旧服务器上公开Web服务,并且只有在有等待反馈的详细信息时,当前系统才会每5分钟“ ping”一次,以尝试获取反馈。 Personally I'm more of a fan of Option A, but please consider that there are multiple scenario that you need to take in account on both side when dealing with an asynchronous elaboration with queue.. EG say that the legacy system is temporarily unavailable or overloaded, and the new system builds a backlog > of 100 (or whatever the magic number is), you will have to consider as well a mechanism to handle backlog queue giving some kind of "preference"/urgency for queued item. 就我个人而言,我更喜欢Option A,但请考虑在处理带有队列的异步操作时,您需要同时考虑多种情​​况。例如,说遗留系统暂时不可用或超载,并且新系统构建的积压大于100(或任何神奇的数字),您还必须考虑一种机制,以处理积压队列,为排队的物料提供某种“优先” /紧急性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM