Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5738280

Browse files
author
Thomasr
committed
add deploymentid into events published
1 parent052374a commit5738280

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

‎server/api-service/lowcoder-infra/src/main/java/org/lowcoder/infra/event/AbstractEvent.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
packageorg.lowcoder.infra.event;
22

33
importlombok.Getter;
4+
importlombok.Setter;
45
importlombok.experimental.SuperBuilder;
56
importorg.lowcoder.plugin.api.event.LowcoderEvent;
67

@@ -18,6 +19,8 @@ public abstract class AbstractEvent implements LowcoderEvent
1819
protectedfinalBooleanisAnonymous;
1920
privatefinalStringipAddress;
2021
protectedMap<String,Object>details;
22+
@Setter
23+
privatestaticStringdeploymentID;
2124

2225
publicMap<String,Object>details()
2326
{
@@ -33,6 +36,7 @@ public B detail(String name, String value)
3336
details =newHashMap<>();
3437
}
3538
this.details.put(name,value);
39+
this.details.put("deploymentID",deploymentID);
3640
returnself();
3741
}
3842
}
@@ -51,5 +55,6 @@ public void populateDetails() {
5155
}
5256

5357
}
58+
details.put("deploymentID",deploymentID);
5459
}
5560
}

‎server/api-service/lowcoder-server/src/main/java/org/lowcoder/runner/eventlistener/AppEventListener.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
packageorg.lowcoder.runner.eventlistener;
22

3+
importlombok.RequiredArgsConstructor;
4+
importorg.lowcoder.infra.config.model.ServerConfig;
5+
importorg.lowcoder.infra.config.repository.ServerConfigRepository;
6+
importorg.lowcoder.infra.event.AbstractEvent;
37
importorg.lowcoder.sdk.exception.BizError;
48
importorg.springframework.boot.context.event.ApplicationReadyEvent;
59
importorg.springframework.context.event.EventListener;
610
importorg.springframework.stereotype.Component;
711

812
importlombok.extern.slf4j.Slf4j;
13+
importreactor.core.publisher.Mono;
914

1015
@Slf4j
1116
@Component
17+
@RequiredArgsConstructor
1218
publicclassAppEventListener {
1319

20+
privatefinalServerConfigRepositoryserverConfigRepository;
1421
@EventListener
1522
publicvoidonApplicationEvent(ApplicationReadyEventevent) {
1623
System.out.println(
@@ -23,5 +30,7 @@ public void onApplicationEvent(ApplicationReadyEvent event) {
2330
"""
2431
);
2532
log.info("check BizError duplicates: {}",BizError.values().length);
33+
StringdeploymentId = (String)(serverConfigRepository.findByKey("deployment.id").map(ServerConfig::getValue).switchIfEmpty(Mono.just("")).block());
34+
AbstractEvent.setDeploymentID(deploymentId);
2635
}
2736
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp