在 SOA 架构中可以从另一个服务调用一个服务吗?

发布于 2024-10-11 18:54:04 字数 127 浏览 3 评论 0原文

我想我知道这个问题的答案,但我刚刚发现有人在做完全相反的事情 - 他是一位非常熟练的开发人员,他们只是度过了糟糕的一天吗?

问:可以从 SOA 架构系统中的服务内部调用服务吗?

我怀疑不是,但我还是会问...

I think I know the answer to this one, but I have just spotted someone doing exactly the opposite - who is a very skilled developer, were they just having a bad day?

Q: Is it OK to call a service from within a service in an SOA architected system?

I suspect not, but i'll ask anyway...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

白馒头 2024-10-18 18:54:04

我想不出有什么理由不这么做。我可以想到一个服务可以调用另一个服务的多种原因。我已经设计并实现了多个服务来执行此操作。我还知道建立此类系统的其他架构。

I can't think of any reason why not. I can think of multiple reasons why a service could call another service. I've architected and implemented multiple services that do this. I'm also aware of other architectures that set up this sort of system.

西瓜 2024-10-18 18:54:04

绝对是的。这种 SOA 模式通常称为编排,其中一个 Web 服务进行处理,然后将消息沿着处理管道传递给另一个 Web 服务。谷歌一下,你会发现一些很好的参考。
另一种情况可能是更多技术原因,例如路由,您有前端 Web 服务,可以根据安全策略、内容、桥接不同技术或传输协议等将消息路由到不同的后端服务。

Definitely yes. This SOA pattern is commonly called choreography where one web service processes and then passes the message to another down a processing pipeline. Google it and you will find some good references.
Another case may be more technical reason like routing, where you have frontend webservices that routes your messaged to different backend services based on security policy, content, bridge different technology or transport protocol etc.

攀登最高峰 2024-10-18 18:54:04

这个问题的答案一如既往地是“这取决于……”让我解释一下我的意思。

在 SOA 中调用另一个服务当然是完全可以接受的事情,SOA 的核心是能够从现有服务中组合出新的东西。

更重要的部分是如何调用服务,请考虑一个 SOA 系统,其中多个服务在调用链中协作,调用每个服务,并将另一个服务纳入事务范围。在没有仔细规划的情况下执行此类操作将对您的系统性能产生巨大影响。使用划分良好的服务(其范围位于正确的工作单元)设计的相同调用链受到的影响较小。

考虑系统的鲁棒性,在典型的架构中,一项服务往往比其他服务更受欢迎,并且最终会被许多其他服务调用。这一项服务的失败会导致整个系统瘫痪,因为所有其他服务都依赖于对这一服务的调用。

考虑一下同步调用和异步调用的区别,什么时候使用什么?那各自的影响是什么呢?

如何设计和划分服务以限制每次调用跨越服务边界的成本?

有很多问题,但如果你环顾四周,有很多地方可以找到答案,我建议从这些开始。

我建议您阅读 Thomas Erl 和 Roger Sessions 撰写的文章,这将使您牢牢掌握 SOA 的含义。

构建 SOA

SOA 设计模式

在 SOA 中实现完整性

为什么您的 SOA 应该像 VW Beetle

为您的老板解释 SOA

WCF 服务性能

The answer to this is as always "it depends..." let me explain what I mean.

Calling another service in a SOA is of course a totally acceptable thing to do, it is at the heart of SOA to be able to compose new things out of existing services.

The more important part is how you call the services, consider a SOA system where multiple services collaborate in a call chain call each one enlisting the other in the transactional scope. Doing this sort of thing without careful planning will have a massive impact on your systems performance. The same call chain designed using well partitioned services that are scoped at the correct unit of work suffers less.

Consider system robustness, in a typical architecture one service tends to become more popular than others and lands up having many other services calling it. A failure of this one service brings down the entire system due to all the other services being dependent on the call to this one service.

Consider the difference between synchronous and asynchronous calls, when do you use what? That is the impact of each?

How do you design and partition services to limit the cost of crossing the service boundary on each call?

Lots of questions, but if you look around there are many places to find answers, I suggest starting with these.

I would suggest you read articles by Thomas Erl and Roger Sessions, this will give you a firm handle on what SOA is all about.

Building a SOA

SOA Design Pattern

Achieving integrity in a SOA

Why your SOA should be like a VW Beetle

SOA explained for your boss

WCF Service Performance

蝶…霜飞 2024-10-18 18:54:04

思考“关注点分离”的架构目标。它可以依赖其他专门的服务来共享功能,而不是每个服务都知道如何做所有事情

think about the architectural goal of "separation of concerns". instead of each service knowing how to do everything, it can rely on other specialized services for shared pieces of functionality

抠脚大汉 2024-10-18 18:54:04

我有一些不同的场景。如果您想在 SOA 中实现服务级别集群怎么办?例如,假设持久化服务驻留在一台机器上,负责处理集群中的所有持久化任务。因此,在需要持久性功能的其他机器上,只需连接到该机器(忽略故障转移因素)。

现在登录时,如果 User 服务直接有 Persistence 服务的实例,那么您将无法实现服务级别集群。

我们有 SOA 中间件,我直接互相调用服务。但是,当我们使用 JMS/ActiveMQ 实现服务级别集群时,我们遇到了那些互连服务的问题。

I have some different scenario. What if you want to implement service level clustering in your SOA? For example, say persistence service is resides on one machine and is responsible for handling all persistence tasks in the cluster. So, on other machine which needs persistence functionality, need to connect to the that machine only(ignore fail over factor).

Now while login, if User service has instance of Persistence service directly, then you will not be able to implement service level clustering.

We have our SOA middleware and I called service from each other directly. But when we implemented service level clustering using JMS/ActiveMQ, we faced the problem for those interconnected services.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文