简体   繁体   English

委派来自第三方服务器的请求的最佳方法是什么?

[英]What is the best way to delegate requests from third party servers?

We have a third party company that we communicate with; 我们有一个与之通信的第三方公司; we send them an information request, they send some information back. 我们向他们发送信息请求,他们向他们发送一些信息。 The issue is that right now, we only have this working on the production server. 问题是,现在,我们只能在生产服务器上使用它。 We have several other servers (dev, staging, uat, content editing) that need to make use of this information. 我们还有其他几个服务器(开发,登台,维护,内容编辑)需要利用此信息。 So I make call to the third party with any server, they respond and I need a way to figure out which of our servers made the request. 因此,我会与任何服务器打电话给第三方,他们会响应,并且我需要一种方法来确定我们的服务器是哪个服务器发出请求的。

The third party company will not change their code; 第三方公司不会更改其代码; we can give them a single server end point to respond to. 我们可以给他们一个服务器端点来响应。

I know I can probably write something that does this, but I figure there is something that already does this and I am just not searching for the right terms. 我知道我可能会写一些做到这一点的东西,但是我认为已经有一些事情做到了,而我只是在寻找正确的术语。

I am using Java with Apache Tomcat. 我将Java与Apache Tomcat一起使用。

Let's divide your problem into two problems. 让我们将您的问题分为两个问题。

Your essential problem is splitting the traffic. 您的基本问题是分配流量。 You can use a tool like Gor for this purpose. 为此,您可以使用Gor之类的工具。 I found this tool from here . 我从这里找到了这个工具。

Your other problem is filtering: guaranteeing that your traffic goes to the correct destination. 另一个问题是过滤:保证您的流量到达正确的目的地。 This is when you can't simply send all of the traffic to all possible destinations. 这是您不能简单地将所有流量发送到所有可能的目的地的时候。 Some common reasons include high volume or sensitive data. 一些常见的原因包括大量或敏感数据。

Filtering is highly dependant on your particular domain, so I don't believe there are any out of box implementations. 过滤高度依赖于您的特定域,因此我认为没有任何现成的实现。 However, scripting it should be fairly straightforward. 但是,编写脚本应该相当简单。

If and how you can do filter the data depends on the API. 是否以及如何过滤数据取决于API。 Sometimes the API generates an unique identifier for each request that you make. 有时,API会为您提出的每个请求生成唯一的标识符。 Some other API-s let you generate an unique identifier yourself. 其他一些API可让您自己生成唯一标识符。

For example you can do the outgoing request through some two-way proxy that will remember the machine and unique identifier, and then the proxy filters any incoming requests by that unique identifier. 例如,您可以通过一些双向代理来执行传出请求,该代理将记住计算机和唯一标识符,然后该代理通过该唯一标识符过滤所有传入请求。

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

相关问题 测试工厂/制造商生产缺少良好相等性的第三方对象的最佳方法是什么? - What is the best way to test a factory/builder producing third party objects that lack a good equality? 在OSGi捆绑包中添加第三方Maven依赖项的最佳方法 - Best way to add Third party maven dependencies in OSGi bundle 无需第三方库即可下载远程映像的最佳方法? - Best way to download remote images without third party libraries? 在Java程序中包含第三方jar文件的最佳实践是什么? - What is the best practice for including third party jar files in a Java program? 将工作委托给其他人的单元测试类的最佳方法是什么? - What's the best way to unit test classes that delegate the work to others? 第三方库在Tomcat中的最佳实践 - Third party libraries best practice in Tomcat 记录从Servlet到数据库的请求的最佳方法? - Best way to log requests from a servlet and to a database? 用Java记录第三方库的使用的标准/官方方式是什么? - What's the standard/official way for documenting the use of a third party library in Java? 第三方集成的双向密码加密 - Two way password encryption for third party integration 第三方库的新版本如何? - What about new versions of third party libraries?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM