SOFAStack Microservices provides common solutions for distributed applications. It supports online configuration, management, and monitoring of SOFA applications. It primarily uses SOFARPC to publish and reference services. Features such as service registration, dynamic configuration, service throttling, and service degradation are designed to support SOFARPC. This quick start guide uses an SOFARPC implementation to walk you through the microservice process.
Procedure
Implement an SOFARPC service locally.
You can use the SOFABoot framework to implement an SOFARPC service locally. This involves the following steps:
Set up the SOFABoot environment.
For more information, see Set up the environment.
Create SOFABoot web projects to act as the service publisher and the service reference.
You can generate two SOFABoot web projects, one as the service publisher and one as the service reference, using either of the following methods:
Create two SOFABoot web projects. For more information, see Create a project.
Download the SOFARPC Demo directly. For more information, see SOFARPC Quick Start.
Develop the local business logic.
For information about importing microservice components, see the following documents:
For the DRM component, see Dynamic Configuration Quick Start.
For the Guardian component, see Service Throttling Quick Start.
Configure
application.properties.This configuration is not required for local testing. Before you publish to the cloud, make sure to configure the following properties. For more information, see Import SOFA middleware.
Add dependencies for microservice components.
Add the following dependencies to the pom.xml file of the
endpointmodule in your SOFABoot web project:Dynamic configuration dependency
<dependency> <groupId>com.alipay.sofa</groupId> <artifactId>ddcs-enterprise-sofa-boot-starter</artifactId> </dependency>Service throttling dependency
<dependency> <groupId>com.alipay.sofa</groupId> <artifactId>guardian-sofa-boot-starter</artifactId> </dependency>
Package the application and publish it to the cloud.
Package the local application.
For the procedure, see Run locally.
Publish the application.
For the overall application publishing flow, see Technology Stack Guide.
For detailed steps on publishing the application, see Quick Start.
Manage and administer services.
You can use the SOFAStack console to manage microservice applications, including dynamic configuration, application dependency, service throttling, service degradation, service degradation, fault injection, and service authentication.
NoteCurrently, the SOFAStack console uses SOFARegistry for service registration, discovery, and reference. Connecting to the registry through a VPN is not supported. If you use a local registry, you cannot use the service management and administration features in the SOFAStack console.
You can test the SOFARPC service locally using a direct IP connection. However, you cannot use the microservice management and administration features locally.