Cloud Foundry中的应用到应用通信 [英] App to App communication in Cloud Foundry

查看:54
本文介绍了Cloud Foundry中的应用到应用通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您要部署2个应用程序,其中一个为第二个应用程序提供一些API。

Assume you want to deploy 2 apps of which one provides some API to the second application.

对于服务,我只是将服务绑定(或声明为清单中的依赖项),从而获得有关传递给我的应用程序的主机,端口和凭据的信息(例如,通过node.js中的env变量)。

With services I'd just bind the service (or declare it as dependency in my manifest) to my application and hence get the information regarding host, port and credentials passed to my application (e.g. via env variables in node.js). Is there a similiar mechanism for application to application "communication"?

到目前为止,我的方法是使用两个应用程序都使用的RabbitMQ服务(或任何消息代理/队列)。

So far my approach is to use a RabbitMQ service (or any message broker/queue) which both applications are bound to and which I then use for cross-app communication.

谢谢!

推荐答案

像您一样使用消息代理绝对是一种可行的解决方案。这允许异步通信。然而,与应用程序服务通信相反,应用程序服务通信是通过cloudfoundry服务绑定建立的,因此您将必须自己进行认证。

Using a message broker, as you do, is definitely a viable solution. This allows for asynchronous communication. Yet you will have to take care of authentication yourself, as opposed to app <-> service communication, where authentication/authorization is established through through cloudfoundry service binding.

另一种方法是为此使用服务注册表。这两个应用程序都将在服​​务注册表中注册,并且能够相互发现。

Another way would be to use a service registry for this. Both apps would register with the service registry and be able to discover each other.

您可以尝试使用Spring Cloud Service Registry(Eureka)或领事。对于您的消息代理解决方案,这不会像cloudfoundry服务绑定那样为您的应用程序生成凭据。

You could try spring cloud service registry (Eureka) or consul. As for your message broker solution, this will not generate credentials for your apps, as a cloudfoundry service binding does.

这篇关于Cloud Foundry中的应用到应用通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆