edit-icon download-icon

Dubbo development

Last Updated: Apr 18, 2018

Currently, EDAS fully supports Spring Cloud applications and they can be deployed directly in EDAS.

  • The concept behind Spring Boot is to ‘Build Anything’, helping resolve complicated XML configuration problems.
  • The concept behind Spring Cloud is to ‘Coordinate Anything’, helping simplify the development of distributed microservices by providing a large number of spring-cloud-starters, which are convenient for component access.

Dubbo is an open-source framework and an official dubbo-spring-boot-starter version is also available. See GitHub for details on Dubbo code and how to use Dubbo for application development.

You must upgrade your Dubbo to a commercial version if you want the applications you develop with Dubbo to benefit from advanced features such as full-link tracking, service analysis, rate limiting, service downgrading, and so on.

This document describes how to upgrade the Dubbo in the Spring Boot programming model to a commercial version by modifying the code. It also describes how to deploy local applications on the EDAS platform. The process of application development is not described in detail here.

To download the demo code for the commercial version of Dubbo, click here: edas-dubbo-spring-boot-demo.

Preparations

Configure Maven private server

Third-party packages of Spring Cloud for Aliware (including the commercial version of Dubbo) are currently only published in private servers on EDAS. For instructions on how to configure private Maven servers, see How to configure an EDAS private server address in Maven.

Note : The version of Maven you use must be 3.x or later. Please add your EDAS private server address in your Maven configuration file Settings.xml. For a sample file, click Download.

Light-Weight Configuration Center

Upgrading to the commercial version of Dubbo does not affect the original service registration feature, which is still effective. The original service is also extended to the EDAS service registration center.

Note: For local development and debugging with the commercial version of Dubbo, you must start the Light-Weight Configuration Center .

The Light-Weight Configuration Center provides a lightweight version of EDAS service discovery and configuration management features. See Light-Weight Configuration Center for details and downloads.

How to upgrade to the commercial version

Increase Maven dependencies

Increase spring-cloud-starter-pandora dependencies in the project pom.xml.

  1. <dependency>
  2. <groupId>org.springframework.cloud</groupId>
  3. <artifactId>spring-cloud-starter-pandora</artifactId>
  4. <version>1.2</version>
  5. </dependency>

Add or modify the plug-in for the Maven file package.

Add or modify the plug-in for the Maven file package in the project pom.xml. To avoid conflicts with other package plug-ins, please do not add any other FatJar plug-ins to build plugin. .

  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>com.taobao.pandora</groupId>
  5. <artifactId>pandora-boot-maven-plugin</artifactId>
  6. <version>2.1.7.8</version>
  7. <executions>
  8. <execution>
  9. <phase>package</phase>
  10. <goals>
  11. <goal>repackage</goal>
  12. </goals>
  13. </execution>
  14. </executions>
  15. </plugin>
  16. </plugins>
  17. </build>

Modify the code

In the start class of Spring Boot, add two lines of Pandora code:

  1. import com.taobao.pandora.boot.PandoraBootstrap;
  2. import org.springframework.boot.SpringApplication;
  3. import org.springframework.boot.autoconfigure.SpringBootApplication;
  4. @SpringBootApplication
  5. public class ServerApplication {
  6. public static void main(String[] args) {
  7. PandoraBootstrap.run(args);
  8. SpringApplication.run(ServerApplication.class, args);
  9. PandoraBootstrap.markStartupAndWait();
  10. }
  11. }

Deploy local applications to EDAS

  1. When creating an application, please choose the latest version of the container.
  2. Run the mvn clean package command in the directory where the project is located and pack it into a FatJar file.
  3. When deploying an application, please upload the FatJar files to deploy the local application onto EDAS.
Thank you! We've received your feedback.