Service to Service Communication
Service to service communication is crucial when you build microservices. A microservice-based application typically runs on a single process, and they can interact with each other using a communication protocol, for example, HTTP or TCP. Oracle Application Container Cloud Service allows you to interconnect your applications using different methods depending on the type of application.
Oracle Application Container Cloud Service supports two types of applications:
Web Applications
A web application is a public application that you can access with a public URL. By default, all applications on Oracle Application Container Cloud Service are web applications.
Web applications can be invoked from another web or worker application by using one of the two options:
-
Using the public URL. For example, a REST API exposed by application 'appB' can be invoked by another service 'appA' by making use of the public URL.
-
Using the internal overlay network. Applications can communicate with each other over a secure internal network if all of the applications are marked as
isClustered
. The application name is used as the host name:-
If the application binds to the \
PORT
environment variable., then it can be accessed on port 8080 over HTTP. The URL format ishttp://<application_name>:8080
. -
If an application binds to a custom port (for example, 9090) in addition to the
PORT
environment variable and a different protocol, then it can be accessed by using that port and protocol over which it has exposed its service (for example, TCP or HTTP). The URL format ishttp://<application_name>:<custom_port>
.
-
Worker Applications
A worker application is a private application that doesn’t have a public URL.
Worker applications can only be invoked from another web or worker application by using an internal overlay network. They can talk to each other over a secure internal network if all of them are marked as isClustered
.
To invoke a worker application, the application name is used as the host name and it can be accessed by using the port and the protocol where the service is exposed. For example, a REST API over 8082 or a TCP service over 9090. The URL format is http://<application_name>:<port>
.
Communication Patterns
A combination of the different application types and clustering capability leads to following access communication patterns:
Access Pattern | Description | Public Network Access (Internet) | Internal (overlay) Network Access (Clustered) |
web-web | A web application that invokes another web application. | Yes | Yes |
web-worker | A web application that invokes a worker application. | No | Yes |
worker-web | A worker application that invokes a web application. | Yes | Yes |
worker-worker | A worker application that invokes another worker application | No | Yes |
Tutorial - Invoke a worker application from a web application
For more information, see Design Considerations and Clustered Applications.