Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions samples/springboot-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
<module>web/tomcat</module>
<module>web/webflux/base</module>
<module>web/webflux/biz</module>
<module>service/base</module>
<module>service/biz1</module>
<module>service/biz2</module>
<module>service</module>
<module>slimming/log4j2</module>
<module>msg/kafka/base</module>
<module>msg/kafka/biz1</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ public class SampleController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String hello() {

Provider studentProvider = SpringServiceFinder.getModuleService("biz", "0.0.1-SNAPSHOT",
Provider studentProvider = SpringServiceFinder.getModuleService("biz1", "0.0.1-SNAPSHOT",
"studentProvider", Provider.class);
Result result = studentProvider.provide(new Param());
System.out.println(result.getClass());
System.out.println(result.isSuccess());
System.out.println(result.getPeople().getClass());
System.out.println(result);

Provider teacherProvider = SpringServiceFinder.getModuleService("biz", "0.0.1-SNAPSHOT",
Provider teacherProvider = SpringServiceFinder.getModuleService("biz1", "0.0.1-SNAPSHOT",
"teacherProvider", Provider.class);
Result result1 = teacherProvider.provide(new Param());
System.out.println(result1.getClass());
System.out.println(result1.isSuccess());
System.out.println(result1.getPeople().getClass());
System.out.println(result1);

Map<String, Provider> providerMap = SpringServiceFinder.listModuleServices("biz", "0.0.1-SNAPSHOT",
Map<String, Provider> providerMap = SpringServiceFinder.listModuleServices("biz1", "0.0.1-SNAPSHOT",
Provider.class);
for (String beanName : providerMap.keySet()) {
Result result2 = providerMap.get(beanName).provide(new Param());
Expand Down
9 changes: 3 additions & 6 deletions samples/springboot-samples/service/base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
<module>base-bootstrap</module>
</modules>
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>springboot-samples</artifactId>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>cross-biz-calling</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>base</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sample-service-base</name>
<description>sample-service-base</description>
<packaging>pom</packaging>

<dependencyManagement>
Expand Down
9 changes: 3 additions & 6 deletions samples/springboot-samples/service/biz1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
<module>biz1-facade</module>
</modules>
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>springboot-samples</artifactId>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>cross-biz-calling</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sample-service-biz</name>
<description>sample-service-biz</description>

<dependencyManagement>
<dependencies>
Expand Down
9 changes: 3 additions & 6 deletions samples/springboot-samples/service/biz2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
<module>biz2-facade</module>
</modules>
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>springboot-samples</artifactId>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>cross-biz-calling</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>biz2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sample-service-biz2</name>
<description>sample-service-biz2</description>

<dependencyManagement>
<dependencies>
Expand Down
21 changes: 21 additions & 0 deletions samples/springboot-samples/service/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>springboot-samples</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<groupId>com.alipay.sofa.service</groupId>
<artifactId>cross-biz-calling</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
<module>base</module>
<module>biz1</module>
<module>biz2</module>
</modules>
</project>
27 changes: 23 additions & 4 deletions samples/springboot3-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.9</version>
<version>3.2.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -18,10 +18,10 @@
<packaging>pom</packaging>

<properties>
<spring.boot.version>3.0.9</spring.boot.version>
<spring.boot.version>3.2.1</spring.boot.version>
<java.version>17</java.version>
<sofa.ark.version>3.0.1</sofa.ark.version>
<sofa.serverless.runtime.version>0.5.5-jdk17</sofa.serverless.runtime.version>
<sofa.serverless.runtime.version>0.5.6-jdk17-SNAPSHOT</sofa.serverless.runtime.version>
<disruptor.version>3.4.2</disruptor.version>
<os.plugin.version>1.7.1</os.plugin.version>
<protobuf.plugin.version>0.6.1</protobuf.plugin.version>
Expand Down Expand Up @@ -103,6 +103,25 @@
<artifactId>sofa-serverless-app-starter</artifactId>
<version>${sofa.serverless.runtime.version}</version>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>log-sofa-boot-starter</artifactId>
<version>3.9.1</version>
</dependency>

<dependency>
<!-- 增加适配 springboot3 的 sofa-common-tools 版本 -->
<groupId>com.alipay.sofa.common</groupId>
<artifactId>sofa-common-tools</artifactId>
<version>2.0.3</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -133,4 +152,4 @@
</profile>
</profiles>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
*/
public class ArkletComponentRegistry {

private static final ArkletLogger LOGGER = ArkletLoggerFactory.getDefaultLogger();

private static final Injector componentInjector = Guice
.createInjector(new ComponentGuiceModule());

Expand All @@ -60,20 +58,20 @@ public class ArkletComponentRegistry {

private static void initComponents() {
String components = componentList.stream().map(s -> s.getClass().getSimpleName()).collect(Collectors.joining(", "));
LOGGER.info("found components: {}", components);
LOGGER.info("start to initialize components");
ArkletLoggerFactory.getDefaultLogger().info("found components: {}", components);
ArkletLoggerFactory.getDefaultLogger().info("start to initialize components");
for (ArkletComponent component : componentList) {
component.init();
}
LOGGER.info("finish initialize components");
ArkletLoggerFactory.getDefaultLogger().info("finish initialize components");
}

private static void destroyComponents() {
LOGGER.info("start to destroy components");
ArkletLoggerFactory.getDefaultLogger().info("start to destroy components");
for (ArkletComponent component : componentList) {
component.destroy();
}
LOGGER.info("finish destroy components");
ArkletLoggerFactory.getDefaultLogger().info("finish destroy components");
}

public static UnifiedOperationService getOperationServiceInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,29 @@
@Setter
public class ProcessRecord {

private static final ArkletLogger LOGGER = ArkletLoggerFactory.getDefaultLogger();
private String requestId;

private String requestId;
private ArkBizMeta arkBizMeta;

private ArkBizMeta arkBizMeta;
private String threadName;

private String threadName;
private Status status;

private Status status;
private Throwable throwable;

private Throwable throwable;
private String errorCode;

private String errorCode;
private String message;

private String message;
private Date startTime;

private Date startTime;
private long startTimestamp;

private long startTimestamp;
private Date endTime;

private Date endTime;
private long endTimestamp;

private long endTimestamp;

private long elapsedTime;
private long elapsedTime;

public enum Status {

Expand Down Expand Up @@ -102,21 +100,24 @@ public boolean finished() {
public void start() {
if (INITIALIZED.equals(getStatus())) {
setStatus(EXECUTING);
LOGGER.info("Command execution status change: INIT -> EXECUTING");
ArkletLoggerFactory.getDefaultLogger().info(
"Command execution status change: INIT -> EXECUTING");
}
}

public void success() {
if (EXECUTING.equals(getStatus())) {
setStatus(SUCCEEDED);
LOGGER.info("Command execution status change: EXECUTING -> SUCCESS");
ArkletLoggerFactory.getDefaultLogger().info(
"Command execution status change: EXECUTING -> SUCCESS");
}
}

public void fail() {
if (EXECUTING.equals(getStatus())) {
setStatus(FAILED);
LOGGER.info("Command execution status change: EXECUTING -> FAIL");
ArkletLoggerFactory.getDefaultLogger().info(
"Command execution status change: EXECUTING -> FAIL");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package com.alipay.sofa.serverless.arklet.core.health;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alipay.sofa.ark.api.ArkClient;
import com.alipay.sofa.ark.common.util.AssertUtils;
import com.alipay.sofa.ark.common.util.StringUtils;
Expand Down Expand Up @@ -47,7 +45,6 @@
@Singleton
public class HealthServiceImpl implements HealthService {

private static final ArkletLogger LOGGER = ArkletLoggerFactory.getDefaultLogger();
private final HealthBuilder healthBuilder = new HealthBuilder();

private final Map<String, Indicator> indicators = new ConcurrentHashMap<>(3);
Expand Down Expand Up @@ -190,7 +187,8 @@ public Indicator getIndicator(String indicatorId) {
@Override
public void registerIndicator(Indicator indicator) {
this.indicators.put(indicator.getIndicatorId(), indicator);
LOGGER.info("register indicator " + indicator.getIndicatorId());
ArkletLoggerFactory.getDefaultLogger().info(
"register indicator " + indicator.getIndicatorId());
}

private void initIndicators() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
*/
public class BatchInstallHelper {

private static final ArkletLogger LOGGER = ArkletLoggerFactory.getDefaultLogger();

/**
* 判断是否是 biz jar 文件
* 目前简单的以后缀 '-biz.jar' 为约束。
Expand All @@ -62,7 +60,8 @@ public List<String> getBizUrlsFromLocalFileSystem(String absoluteBizDirPath) {
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
Path absolutePath = file.toAbsolutePath();
if (isBizJarFile(absolutePath)) {
LOGGER.info("Found biz jar file: {}", absolutePath);
ArkletLoggerFactory.getDefaultLogger().info("Found biz jar file: {}",
absolutePath);
bizUrls.add(absolutePath.toString());
}
return FileVisitResult.CONTINUE;
Expand Down
4 changes: 1 addition & 3 deletions sofa-serverless-runtime/arklet-springboot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.core}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -43,7 +42,6 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.core}</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -114,4 +112,4 @@

</dependencies>

</project>
</project>
Loading