Introduction to Soul Framework

Soul is an asynchronous, high-performance, responsive API gateway open source framework based on the Java language. The framework was initiated by Xiao Yu (Cat Adult) from JD.com and developed with more than 10 other members.

The Soul framework supports a variety of protocols, rich built-in plug-ins, supports hot swap, dynamic configuration, and gateway performance of about 1 to 2ms.

Basic Architecture of Soul

The user’s Http request is sent to the Soul gateway cluster through Nginx. The configured plug-ins and protocols take effect one by one through chain calls. The dynamic configuration of the management background is synchronized to the gateway cluster. (a lot of question marks still need to be explored 🙂

Soul Project structure

The latest 2.2.1 is used as an example to analyze the basic functions of each module.

  • Soul-admin: gateway management background for dynamic configuration of plug-ins and rules.
  • Soul-bootstrap: gateway startup module;
  • Soul-client: a soul-client module that supports different protocols, such as Dubbo and HTTP.
  • Soul-common: common module, common entity definition;
  • Soul-dist.
  • Soul-examples: example code;
  • Soul-metrics: monitoring module;
  • Soul-plugin: Define rich plug-ins;
  • Soul-regiser-center: configuration registry, such as ZK.
  • Soul-spi: Hot-swappable plug-ins based on SPI mechanism.
  • Soul-spring-boot-starter: supports spring boot.
  • Soul-sync-data-center: data synchronization module;
  • Soul-web: Web module;

Soul Single-node deployment

Run the soul – the admin

  • Fork a copy at Github and pull it locally
  • Create the soul database in Mysql
mysql> create database soul; Query OK, 1 row affected (0.01sec)Copy the code
  • Modify theapplication.ymlDatabase configuration in
  • Execution startup class:SoulAdminBootstrap
  • accesshttp://127.0.0.1:9095/, the use ofadmin/123456The login

Run the soul – the bootstrap

  • Execution startup classSoulBootstrapApplication
The 2021-01-15 08:33:51. 22994-281 the INFO [the main] O.D.S.B.S oulBootstrapApplication: Starting SoulBootstrapApplication on XXX. Local with PID 22994 (soul) 2021-01-15 08:33:51.281 INFO 22994 -- [main] o.d.s.b.SoulBootstrapApplication : The following profiles are active: Local 08:33:52 2021-01-15. 22994-634 the INFO [main] S.D.R.C.R epositoryConfigurationDelegate: Multiple Spring Data modules found, entering strict repository configuration mode! The 2021-01-15 08:33:52. 22994-638 the INFO [main]. S.D.R.C.R epositoryConfigurationDelegate: Bootstrapping Spring Data Redis repositories in DEFAULT Mode. 2021-01-15 08:33:52.692 INFO 22994 -- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data Repository scanning in 21ms. Found 0 Redis Repository interfaces. 2021-01-15 08:33:53.609 INFO 22994 --- [ main] o.d.s.w.configuration.SoulConfiguration : The load plugins: [global] [org. Dromara. Soul. Plugin. Global. GlobalPlugin] 2021-01-15 08:33:53. 22994-609 the INFO [main] o.d.s.w.configuration.SoulConfiguration : The load plugins: [sign] [org. Dromara. Soul. Plugin. Sign. SignPlugin] 2021-01-15 08:33:53. 22994-609 the INFO [main] o.d.s.w.configuration.SoulConfiguration : The load plugins: [waf] [org. Dromara. Soul. The plugin. The waf. WafPlugin] 2021-01-15 08:33:53. 22994-610 the INFO [main] o.d.s.w.configuration.SoulConfiguration : Load the plugin: [rate_limiter] [org. Dromara. Soul. Plugin. Ratelimiter. RateLimiterPlugin] 2021-01-15 08:33:53. 610 INFO 22994 --- [ main] o.d.s.w.configuration.SoulConfiguration : The load plugins: [hystrix] [org. Dromara. Soul. Plugin. Hystrix. HystrixPlugin] 2021-01-15 08:33:53. 22994-610 the INFO [main] o.d.s.w.configuration.SoulConfiguration : Load the plugin: [resilience4j] [org. Dromara. Soul. Plugin. Resilience4j. Resilience4JPlugin] 2021-01-15 08:33:53. 610 INFO 22994 --- [ main] o.d.s.w.configuration.SoulConfiguration : The load plugins: [divide] [org. Dromara. Soul. Plugin. Divide. DividePlugin] 2021-01-15 08:33:53. 22994-610 the INFO [main] o.d.s.w.configuration.SoulConfiguration : The load plugins: [webClient] [org. Dromara. Soul. Plugin. Httpclient. WebClientPlugin] 2021-01-15 08:33:53. 22994-610 the INFO [ main] o.d.s.w.configuration.SoulConfiguration : The load plugins: [divide] [org. Dromara. Soul. Plugin. Divide. Websocket. WebSocketPlugin] 2021-01-15 08:33:53. 22994-610 the INFO [  main] o.d.s.w.configuration.SoulConfiguration : load plugin:[alibaba-dubbo-body-param] [org.dromara.soul.plugin.alibaba.dubbo.param.BodyParamPlugin] 2021-01-15 08:33:53. 22994-610 the INFO [main] O.D.S.W.C onfiguration. SoulConfiguration: Load the plugin: [dubbo] [org. Dromara. Soul. Plugin. Alibaba. Dubbo. AlibabaDubboPlugin] 2021-01-15 08:33:53. 22994-610 the INFO [ main] o.d.s.w.configuration.SoulConfiguration : The load plugins: [monitor] [org. Dromara. Soul. Plugin. Monitor. MonitorPlugin] 2021-01-15 08:33:53. 22994-610 the INFO [main] o.d.s.w.configuration.SoulConfiguration : Load the plugin: [response] [org. Dromara. Soul. Plugin. Httpclient. Response. WebClientResponsePlugin] 2021-01-15 08:33:53. 610 INFO 22994 --- [ main] o.d.s.w.configuration.SoulConfiguration : Load the plugin: [response] [org. Dromara. Soul. Plugin. Alibaba. Dubbo. Response. DubboResponsePlugin] 2021-01-15 08:33:53. 874 INFO  22994 --- [ main] b.s.s.d.w.WebsocketSyncDataConfiguration : you use websocket sync soul data....... The 2021-01-15 08:33:54. 22994-072 the INFO [the main] O.D.S.P.S.D.W.W ebsocketSyncDataService: websocket connection is successful..... The 2021-01-15 08:33:54. 22994-217 the INFO [main] O.S.B.A.E.W eb. EndpointLinksResolver: Exposing 2 to the Exposing 2 endpoint(S) : DRIVE to the rim of the RING '/ ring '2021-01-15 08:33:55 INFO 22994 -- [main] o.s.b.web.embedded.netty.NettyWebServer : Netty started on port(s): 9195 the 2021-01-15 08:33:55. 22994-133 the INFO [main] O.D.S.B.S oulBootstrapApplication: Started SoulBootstrapApplication in 5.544 seconds (JVM running for 7.975)Copy the code