简体   繁体   中英

App to App communication in Cloud Foundry

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

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 (eg via env variables in node.js). Is there a similiar mechanism for application to application "communication"?

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.

Thanks!

From your use case, for microservice to microservice discovery, you need Spring Cloud Services and Eureka.

I don't have much experience on nodejs. But some googling, will give you some articles. Here's one that may help you - https://www.npmjs.com/package/eureka-js-client

This article will give you an overview from Java and Spring perspective - https://spring.io/guides/gs/service-registration-and-discovery/ .

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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