All Products
Search
Document Center

Migrate Dubbo to HSF (not recommended)

Last Updated: Feb 02, 2019

Dubbo is an open source RPC framework, while HSF is another RPC framework supported by EDAS.Before the implementation of Dubbo for EDAS, this document provided a solution to convert Dubbo to HSF, enabling rate limiting and degradation, distributed tracing, service analysis, and other functions.Now, EDAS supports Dubbo and offers service governance, distributed tracing, and more functions. For more information, see Quick start.For this reason, we recommend that new users do not use this method.

This topic describes how to convert Dubbo for the Spring Boot programming model to HSF by modifying the code.The process of application development is not described in detail here.

Download the Demos for converting Dubbo to HSF.

Add a Maven dependency

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

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

Add or modify the packaging plug-in for Maven

Add or modify the Maven packaging plugin in the project file pom.xml.To prevent conflicts with other packaging plugins, do not add any other FatJar plugins to the 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.9.1</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 Spring Boot startup class, add these two lines for loading Pandora:

  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. }