diff --git a/caf-boot-starters/caf-boot-starter-rpc-registry-jpa/pom.xml b/caf-boot-starters/caf-boot-starter-rpc-registry-jpa/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..927ce23f9e7467a44527d7c8072bd2613803cdbc --- /dev/null +++ b/caf-boot-starters/caf-boot-starter-rpc-registry-jpa/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + io.iec.edp + caf-boot + 1.7.4-SNAPSHOT + ../../pom.xml + + + caf-boot-starter-rpc-registry-jpa + + + 8 + 8 + UTF-8 + + + + + io.iec.edp + caf-rpc-registry-api + + + io.iec.edp + caf-rpc-registry-core + + + io.iec.edp + caf-rpc-registry-jpa + + + + \ No newline at end of file diff --git a/caf-boot-starters/caf-boot-starter-rpc/src/main/java/io/iec/edp/caf/rpc/config/RpcRegistryAutoConfiguration.java b/caf-boot-starters/caf-boot-starter-rpc-registry-jpa/src/main/java/io/iec/edp/caf/rpc/config/RpcRegistryAutoConfiguration.java similarity index 77% rename from caf-boot-starters/caf-boot-starter-rpc/src/main/java/io/iec/edp/caf/rpc/config/RpcRegistryAutoConfiguration.java rename to caf-boot-starters/caf-boot-starter-rpc-registry-jpa/src/main/java/io/iec/edp/caf/rpc/config/RpcRegistryAutoConfiguration.java index 07361701ed19decd78612a1de58fc3d677085d3a..448e11a1ec30e7bba4b245fe0edde092f2262b95 100644 --- a/caf-boot-starters/caf-boot-starter-rpc/src/main/java/io/iec/edp/caf/rpc/config/RpcRegistryAutoConfiguration.java +++ b/caf-boot-starters/caf-boot-starter-rpc-registry-jpa/src/main/java/io/iec/edp/caf/rpc/config/RpcRegistryAutoConfiguration.java @@ -52,15 +52,21 @@ public class RpcRegistryAutoConfiguration { private RpcDefinitionStorage rpcDefinitionStorage; - @Order(value = Ordered.HIGHEST_PRECEDENCE) +// @Order(value = Ordered.HIGHEST_PRECEDENCE) +// @Bean +// @Lazy(false) +// public ApplicationListener rpcStartupListener() { +// return new RpcStartupCompletedListener(msuEnabled); +// } +// public RpcRegistryAutoConfiguration(RpcServiceDefinitionRepository rpcServiceDefinitionRepository, RpcServiceMethodDefinitionRepository rpcServiceMethodDefinitionRepository) { +// RpcDefinitionManager manager = new RpcDefinitionManager(rpcServiceDefinitionRepository, rpcServiceMethodDefinitionRepository); +// this.rpcDefinitionStorage = new RpcDefinitionStorageDatabaseImpl(manager); +// } @Bean - @Lazy(false) - public ApplicationListener rpcStartupListener() { - return new RpcStartupCompletedListener(msuEnabled); - } - public RpcRegistryAutoConfiguration(RpcServiceDefinitionRepository rpcServiceDefinitionRepository, RpcServiceMethodDefinitionRepository rpcServiceMethodDefinitionRepository) { + public RpcDefinitionStorage createRpcDefinitionStorage(RpcServiceDefinitionRepository rpcServiceDefinitionRepository, RpcServiceMethodDefinitionRepository rpcServiceMethodDefinitionRepository) { RpcDefinitionManager manager = new RpcDefinitionManager(rpcServiceDefinitionRepository, rpcServiceMethodDefinitionRepository); this.rpcDefinitionStorage = new RpcDefinitionStorageDatabaseImpl(manager); + return this.rpcDefinitionStorage; } @Bean diff --git a/caf-boot-starters/caf-boot-starter-rpc-registry-jpa/src/main/resources/META-INF/spring.factories b/caf-boot-starters/caf-boot-starter-rpc-registry-jpa/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000000000000000000000000000000000000..beea3a1fdd1214b8cebac258fb421c53dcf3b854 --- /dev/null +++ b/caf-boot-starters/caf-boot-starter-rpc-registry-jpa/src/main/resources/META-INF/spring.factories @@ -0,0 +1,3 @@ +# Auto Configure +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +io.iec.edp.caf.rpc.config.RpcRegistryAutoConfiguration diff --git a/caf-boot-starters/caf-boot-starter-rpc/src/main/java/io/iec/edp/caf/rpc/config/RpcServerAutoConfiguration.java b/caf-boot-starters/caf-boot-starter-rpc/src/main/java/io/iec/edp/caf/rpc/config/RpcServerAutoConfiguration.java index 7c146a932249de637377cc0e4f93b9e9038f5734..6dfaaf54f7306f4b4220972911542bf3d450fd7b 100644 --- a/caf-boot-starters/caf-boot-starter-rpc/src/main/java/io/iec/edp/caf/rpc/config/RpcServerAutoConfiguration.java +++ b/caf-boot-starters/caf-boot-starter-rpc/src/main/java/io/iec/edp/caf/rpc/config/RpcServerAutoConfiguration.java @@ -26,6 +26,7 @@ import io.iec.edp.caf.rpc.api.event.RpcServerEventBroker; import io.iec.edp.caf.rpc.api.event.RpcServerEventManager; import io.iec.edp.caf.rpc.api.service.InternalServiceManageService; import io.iec.edp.caf.rpc.api.service.RpcServer; +import io.iec.edp.caf.rpc.client.event.RpcStartupCompletedListener; import io.iec.edp.caf.rpc.interceptor.AuthorizingInterceptor; import io.iec.edp.caf.rpc.remote.http.api.RpcServiceApi; import io.iec.edp.caf.rpc.remote.http.discover.CenterAddressDiscover; @@ -36,8 +37,12 @@ import io.iec.edp.caf.rpc.server.RpcServerImpl; import io.iec.edp.caf.rpc.server.invoker.RpcRemoteInvoker; import org.apache.cxf.Bus; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationListener; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; import java.util.ArrayList; import java.util.Arrays; @@ -51,6 +56,13 @@ public class RpcServerAutoConfiguration { @Value("${msu.enable:false}") private Boolean msuEnable; + @Order(value = Ordered.HIGHEST_PRECEDENCE) + @Bean + @Lazy(false) + public ApplicationListener rpcStartupListener() { + return new RpcStartupCompletedListener(msuEnable); + } + // @Bean // public RESTEndpoint rpcServerRest(RpcServiceApi rest) { // return new RESTEndpoint("/runtime/communication/v1.0/rpc", rest); diff --git a/caf-boot-starters/caf-boot-starter-rpc/src/main/resources/META-INF/spring.factories b/caf-boot-starters/caf-boot-starter-rpc/src/main/resources/META-INF/spring.factories index 478cb7e611e0807770d0760c0566693e3e1886b7..9dce910c8a03e21a41a348fdd4d1c4bd0f0791de 100644 --- a/caf-boot-starters/caf-boot-starter-rpc/src/main/resources/META-INF/spring.factories +++ b/caf-boot-starters/caf-boot-starter-rpc/src/main/resources/META-INF/spring.factories @@ -2,5 +2,4 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ io.iec.edp.caf.rpc.config.RpcServerAutoConfiguration,\ io.iec.edp.caf.rpc.config.RpcClientAutoConfiguration,\ -io.iec.edp.caf.rpc.config.GrpcAutoConfiguration,\ -io.iec.edp.caf.rpc.config.RpcRegistryAutoConfiguration +io.iec.edp.caf.rpc.config.GrpcAutoConfiguration diff --git a/caf-boot-starters/pom.xml b/caf-boot-starters/pom.xml index 7b0bf1c8d97b8f8438adc08bbf08be0e822e3da4..bdeafb5f2cd274f245a6efabd7caeed0003cd977 100644 --- a/caf-boot-starters/pom.xml +++ b/caf-boot-starters/pom.xml @@ -54,6 +54,7 @@ caf-boot-starter-rpc-extension caf-boot-starter-business-context caf-boot-starter-application-context + caf-boot-starter-rpc-registry-jpa